reverseproxy

package
v0.155.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigEnvPrefix is the prefix applied to environment variables for configuring Auth0.
	ConfigEnvPrefix = "REVERSEPROXY_"
)

Variables

View Source
var LoadConfig = sync.OnceValues(func() (*Config, error) {
	if err := config.Load(ConfigEnvPrefix, &cfg); err != nil {
		return nil, fmt.Errorf("load config: %w", err)
	}

	if os.Getenv("PORT") != "" {
		if port, err := strconv.ParseUint(os.Getenv("PORT"), 10, 64); err != nil {
			return nil, fmt.Errorf("load port from envrionment: %w", err)
		} else {
			cfg.Port = port
		}
	}
	if err := validation.Validate.Struct(cfg); err != nil {
		return nil, fmt.Errorf("google: unable to validate config: %w", err)
	}
	return &cfg, nil
})

LoadConfig loads the auth0 configuration and ensures this is only done one time, no matter how many times it is called.

Functions

func GenerateProxyURL

func GenerateProxyURL(originalURL string) (string, error)

GenerateProxyURL takes the given URL and generates a new URL to proxy the request through the reverse proxy service.

func IsProxiedURL

func IsProxiedURL(value string) bool

IsProxiedURL returns a boolean indicating whether the given URL is being proxied through the reverse proxy. If this cannot be determined, a non-nil error is also returned and the boolean status should be ignored.

Types

type Config

type Config struct {
	Port    uint64 `koanf:"port"    validate:"required,port"`
	Host    string `koanf:"host"    validate:"required,hostname|fqdn|ip"`
	Key     string `koanf:"key"     validate:"required,base64rawurl"`
	Salt    string `koanf:"salt"    validate:"required,base64rawurl"`
	BaseURL string `koanf:"baseurl" validate:"required,url"`
}

Config contains the reverseproxy configuration options.

Jump to

Keyboard shortcuts

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