caddy_trusted_cloudfront

package module
v0.0.0-...-c4724a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 9 Imported by: 0

README

trusted_proxies cloudfront module for Caddy

The module auto trusted_proxies AWS CloudFront EDGE servers from https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips

Requirements

Install

The simplest, cross-platform way to get started is to download Caddy from GitHub Releases and place the executable file in your PATH.

Build from source

Requirements:

Build:

$ xcaddy build --with github.com/xcaddyplugins/caddy-trusted-cloudfront

Caddyfile Syntax

trusted_proxies cloudfront {
	interval <duration>
}
  • interval How often to fetch the latest IP list. format is caddy.Duration. For example 12h represents 12 hours, and "1d" represents one day. default value 1d.

Caddyfile Example

trusted_proxies cloudfront {
	interval 1d
}
Caddyfile Use Default Settings Example
trusted_proxies cloudfront

Caddyfile Global Trusted Example

Insert the following configuration of Caddyfile to apply it globally.

{
	servers {
		trusted_proxies cloudfront
	}
}

Documentation

Index

Constants

View Source
const (
	FETCH_URL = "https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaddyTrustedCloudFront

type CaddyTrustedCloudFront struct {
	// Interval to update the trusted proxies list. default: 1d
	Interval caddy.Duration `json:"interval,omitempty"`
	// contains filtered or unexported fields
}

The module that auto trusted_proxies `AWS CloudFront EDGE servers` from CloudFront. Doc: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LocationsOfEdgeServers.html Range from: https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips

func (CaddyTrustedCloudFront) CaddyModule

func (CaddyTrustedCloudFront) CaddyModule() caddy.ModuleInfo

func (*CaddyTrustedCloudFront) GetIPRanges

func (s *CaddyTrustedCloudFront) GetIPRanges(_ *http.Request) []netip.Prefix

func (*CaddyTrustedCloudFront) Provision

func (s *CaddyTrustedCloudFront) Provision(ctx caddy.Context) error

func (*CaddyTrustedCloudFront) UnmarshalCaddyfile

func (m *CaddyTrustedCloudFront) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. Syntax:

cloudfront {
   interval <duration>
}

type CloudFrontIPSource

type CloudFrontIPSource struct {
	CloudFrontGlobalIPList       []string `json:"CLOUDFRONT_GLOBAL_IP_LIST"`
	CloudFrontRegionalEdgeIPList []string `json:"CLOUDFRONT_REGIONAL_EDGE_IP_LIST"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL