New Plugin: caddy-s3-proxy

I was looking for a way to proxy content from S3 for an internal website. I could not find one that would work so I wrote one! I think others may find it useful as well.

It can be found here:

It is very new and so there certainly may be bugs and perhaps not every feature you may be wanting.

Please check it out and give feedback!

Ray

3 Likes

Nice! Thanks for sharing this! I noticed:

// TODO: Handle path manipulation (Root, Prefix, HiddenFiles, etc.)

Manipulating the path of a request is usually done with the rewrite handler: Modules - Caddy Documentation – there’s no need, per-se, for your handler to re-implement such logic.

Minor docs thing re xcaddy, if you omit the version tag, then it will grab the latest tagged release of Caddy, so it’s safe to document it as just:

xcaddy build \
        --output /usr/local/bin/caddy \
        --with github.com/lindenlab/caddy-s3-proxy 

You should also note that your directive supports request matching by adding [<matcher>] to the syntax documentation (to match the existing Caddyfile docs, for example reverse_proxy (Caddyfile directive) — Caddy Documentation)

Yea that started to dawn on me as well. I do show an example using “uri strip_prefix”:

Next on my list was to look at how I can support Root. (it just sets a variable I can get access to if I understand it correctly - right?)

Ray

Yes, for example the static file server uses this variable as the default if it is not explicitly configured otherwise:

To use a placeholder like that, use a Replacer like so:

Thank you both for the feedback. I’ve released a new version that supports the root directive. (It now also supports passing through the Range header and passing back a bunch of typical headers from S3.). Also improved the docs - including mentioning the matcher functionality. (As well as the need to use the order directive to use the plugin at the top level.)

Now all I need is a user. (Besides ourselves, of course…)

Ray

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.