lindenlab / caddy-s3-proxy

s3 proxy plugin for caddy
Apache License 2.0
72 stars 22 forks source link

Host variable not replaced on certain requests #52

Open simonjenny opened 2 years ago

simonjenny commented 2 years ago

Certain requests sent from a Browser are not correctly resolved:

Feb 01 11:03:50 wraxx-html-0001 bash[9696]: {"level":"debug","ts":1643709830.4053314,"logger":"http.handlers.s3proxy","msg":"get from S3","bucket":"wraxx","key":"/dash.simonjenny.dev/index.html"}
Feb 01 11:00:47 wraxx-html-0001 bash[9696]: {"level":"debug","ts":1643709647.560506,"logger":"http.handlers.s3proxy","msg":"get from S3","bucket":"wraxx","key":"/{http.request.host}/index.html"}

I already ask in the Caddy Community and it was suggested, that the proxy does not replace the {http.request.host} variable on every request: https://caddy.community/t/how-can-i-handle-empty-host-variables/14936

This is my s3proxy configuration:

s3proxy {
     bucket {$SITES}
     region {$AWS_REGION}
     endpoint {$AWS_HOST}
     index  index.html
     root   /{host}
     errors /{host}/index.html
}

xcaddy build command:

xcaddy build \
    --with github.com/ss098/certmagic-s3 \
    --with github.com/lindenlab/caddy-s3-proxy
simonjenny commented 2 years ago

Alright, after some more digging I found out that {http.request.host} variables are not replaced in errors.

rayjlinden commented 1 year ago

So this is just caddy behavior right? Not a bug in this plugin?

perebusquets commented 9 months ago

Hi, I created a PR aiming to fix this issue, could you please take a look at it? Thanks!

perebusquets commented 2 months ago

Hi, is this being actively maintained? This PR was open by over 8 months. I get it if you can't maintain it, but please mark it as archived so people can fork this project and maintain it properly if necessary. Thank you for your time.

AstraLuma commented 1 month ago

I'm thinking of tackling this in a more comprehensive way, since there's about a dozen config variables that need to be resolved in about four different code paths.

EDIT: #72