caddy/modules
Matthew Holt fbd6560976
fileserver: Only redirect if filename not rewritten (fix #4205)
This is the more correct implementation of  23dadc0d86 (#4179)... I think. This commit effectively undoes the revert in 8848df9c5d, but with corrections to the logic.

We *do* need to use the original request path (the path the browser knows) for redirects, since they are external, and rewrites are only internal.

However, if the path was rewritten to a non-canonical path, we should not redirect to canonicalize that, since rewrites are intentional by the site owner. Canonicalizing the path involves modifying only the suffix (base element, or filename) of the path. Thus, if a rewrite involves only the prefix (like how handle_path strips a path prefix), then we can (hopefully!) safely redirect using the original URI since the filename was not rewritten.

So basically, if rewrites modify the filename, we should not canonicalize those requests. If rewrites only modify another part of the path (commonly a prefix), we should be OK to redirect.
2021-06-17 09:55:49 -06:00
..
caddyhttp fileserver: Only redirect if filename not rewritten (fix #4205) 2021-06-17 09:55:49 -06:00
caddypki go.mod: Update direct dependencies 2021-06-03 12:18:25 -06:00
caddytls httpcaddyfile: Add preferred_chains global option and issuer subdirective (#4192) 2021-06-08 14:10:37 -06:00
filestorage httpcaddyfile: Minor fixes to parsing storage options 2020-05-01 09:34:32 -06:00
logging logging: Actually use level_key (#4189) 2021-06-04 14:15:43 -06:00
metrics metrics: allow disabling OpenMetrics negotiation (#3944) 2020-12-30 11:44:02 -07:00
standard metrics: Initial integration of Prometheus metrics (#3709) 2020-09-17 12:01:20 -06:00