summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/requestbody
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-06-17 09:55:49 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2021-06-17 09:55:49 -0600
commitfbd6560976dc73052bd5d3277869912de68f6731 (patch)
tree3408a848c11eada8de66d1b4acfb13f230ff7454 /modules/caddyhttp/requestbody
parent238914d70b0f6c277494f0296a15eb9eb84ecc76 (diff)
fileserver: Only redirect if filename not rewritten (fix #4205)
This is the more correct implementation of 23dadc0d86dd75dad7559c25f20c9641bc7bc30f (#4179)... I think. This commit effectively undoes the revert in 8848df9c5d372a559d01512b7a4ef00e38867b55, 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.
Diffstat (limited to 'modules/caddyhttp/requestbody')
0 files changed, 0 insertions, 0 deletions