0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
caddy/caddyhttp/rewrite
Matt Holt d5371aff22 httpserver/all: Clean up and standardize request URL handling (#1633)
* httpserver/all: Clean up and standardize request URL handling

The HTTP server now always creates a context value on the request which
is a copy of the request's URL struct. It should not be modified by
middlewares, but it is safe to get the value out of the request and make
changes to it locally-scoped. Thus, the value in the context always
stores the original request URL information as it was received. Any
rewrites that happen will be to the request's URL field directly.

The HTTP server no longer cleans /sanitizes the request URL. It made too
many strong assumptions and ended up making a lot of middleware more
complicated, including upstream proxying (and fastcgi). To alleviate
this complexity, we no longer change the request URL. Middlewares are
responsible to access the disk safely by using http.Dir or, if not
actually opening files, they can use httpserver.SafePath().

I'm hoping this will address issues with #1624, #1584, #1582, and others.

* staticfiles: Fix test on Windows

@abiosoft: I still can't figure out exactly what this is for. 😅

* Use (potentially) changed URL for browse redirects, as before

* Use filepath.ToSlash, clean up a couple proxy test cases

* Oops, fix variable name
2017-05-01 23:11:10 -06:00
..
testdata Migrating more middleware packages 2016-06-05 21:51:56 -06:00
rewrite.go Fix issue #1346 {path} logging {uri} and add {rewrite_uri} placeholder (#1481) 2017-03-11 14:59:47 -07:00
rewrite_test.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
setup.go rewrite: Raise error if rewrite path does not begin with / #1610 (#1629) 2017-05-01 13:45:40 -06:00
setup_test.go rewrite: Raise error if rewrite path does not begin with / #1610 (#1629) 2017-05-01 13:45:40 -06:00
to.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
to_test.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00