awstransport

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

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

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

AWS Transport for Caddy

[!NOTE] The module is not validated -- yet! I don't use AWS personally, so feedback is welcome. Consider it WIP until this is removed. The configuration structure is also subject to change.

This module aims to injects the AWS V4 Signature for requests proxied to AWS services. It also implicitly calculates and sets the x-amz-content-sha256 header value.

Example

Caddyfile
example.com {
	reverse_proxy https://{$BUCKET_NAME}.s3.{$AWS_REGION}.amazonaws.com {
		header_up Host {upstream_hostport}
		transport aws {
			access_id {$AWS_ACCECSS_ID}
			secret_key {$AWS_SECRET_KEY}
			region {$AWS_REGION}
			service {$AWS_SERVICE}

			# other 'http' transport directives per:
			# https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#the-http-transport 
		}
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSTransport

type AWSTransport struct {
	*reverseproxy.HTTPTransport `json:"transport,omitempty"`

	// One part of the AWS security credentials identifying the service user
	AccessKeyID string `json:"access_key_id,omitempty"`

	// The other part of the AWS security credentials
	SecretAccessKey string `json:"secret_access_key,omitempty"`

	// The AWS region, e.g. us-east-2
	Region string `json:"region,omitempty"`

	// The upstream AWS service
	Service string `json:"service,omitempty"`
}

The AWS transport module injects the AWS V4 Signature for requests proxied to AWS services. It also implicitly calculates and sets the `x-amz-content-sha256` header value.

func (*AWSTransport) CaddyModule

func (*AWSTransport) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*AWSTransport) Provision

func (a *AWSTransport) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (*AWSTransport) RoundTrip

func (a *AWSTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

func (*AWSTransport) UnmarshalCaddyfile

func (a *AWSTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Jump to

Keyboard shortcuts

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