It all works great however when the bucket does not have an index.html then the s3proxy will return 403 status code (instead of 404?) while displaying custom error page.
Here's my simplified Caddyfile:
s3proxy {
bucket "nice.bucket"
region "nice.bucket.eu-central-1.linodeobjects.com"
endpoint "eu-central-1.linodeobjects.com"
root "/"
index index.html
errors /404.html
}
So it will display 404.html as expected, but with 403 Forbidden status code. I don't understand why it's 403 for Not Found error.
I can see from the logs that it's looking for index.html (key "/") but not found so it returns 404.
2021/07/09 10:39:28.128 WARN http.handlers.s3proxy error when looking for index {"bucket": "nice.bucket", "key": "/", "err": "NoSuchKey: \n\tstatus code: 404, request id: XXXXX, host id: "}
so I tried to "catch it" with the errors directive
s3proxy {
...
errors 404 /404.html
}
but now it will not render the 404.html at all. That's probably wrong path to follow.
N.B Accessing the file directly from bucket http://nice.bucket.eu-central-1.linodeobjects.com/404.html returns 200 status code. The bucket itself http://nice.bucket.eu-central-1.linodeobjects.com (still without index.html) comes back with 200 as well.
I have had a look at the error mappings here as I understand convertToCaddyError is responsible for rendering the 403 status.
And how does one make s3proxy to log at DEBUG level? I can see few p.log.Debug statements in the source code. I tried Caddyfile with
This is great package. Thanks!
It all works great however when the bucket does not have an
index.html
then the s3proxy will return 403 status code (instead of 404?) while displaying custom error page.Here's my simplified Caddyfile:
So it will display 404.html as expected, but with
403 Forbidden
status code. I don't understand why it's 403 forNot Found
error.I can see from the logs that it's looking for index.html (key "/") but not found so it returns 404.
so I tried to "catch it" with the
errors
directivebut now it will not render the 404.html at all. That's probably wrong path to follow.
N.B Accessing the file directly from bucket
http://nice.bucket.eu-central-1.linodeobjects.com/404.html
returns200
status code. The bucket itselfhttp://nice.bucket.eu-central-1.linodeobjects.com
(still without index.html) comes back with200
as well.I have had a look at the error mappings here as I understand
convertToCaddyError
is responsible for rendering the403
status.And how does one make
s3proxy
to log atDEBUG
level? I can see fewp.log.Debug
statements in the source code. I tried Caddyfile withno to avail.