aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2024-11-27 22:33:48 -0500
committerFrancis Lavoie <[email protected]>2024-12-01 17:21:44 -0500
commit68edb1acd1860552542314cdaec1094a3cb7e33a (patch)
tree2420e16e1593900da35c3d1b8cf7169d9f122aeb
parent2e6f62606764adfafdbef5daff3562bd53a4bc82 (diff)
downloadcaddy-68edb1acd1860552542314cdaec1094a3cb7e33a.tar.gz
caddy-68edb1acd1860552542314cdaec1094a3cb7e33a.zip
fastcgi: Preserve query during canonical redirect
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.caddyfiletest4
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.caddyfiletest2
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.caddyfiletest2
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_subdirectives.caddyfiletest2
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.caddyfiletest2
-rw-r--r--modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go2
6 files changed, 7 insertions, 7 deletions
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.caddyfiletest b/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.caddyfiletest
index 8a57b9e37..bfd0cee50 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.caddyfiletest
@@ -8,7 +8,7 @@ route {
}
not path */
}
- redir @canonicalPath {http.request.orig_uri.path}/ 308
+ redir @canonicalPath {http.request.orig_uri.path}/{http.request.uri.prefixed_query} 308
# If the requested file does not exist, try index files
@indexFiles {
@@ -50,7 +50,7 @@ route {
"handler": "static_response",
"headers": {
"Location": [
- "{http.request.orig_uri.path}/"
+ "{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"
]
},
"status_code": 308
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.caddyfiletest b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.caddyfiletest
index 70a0780d1..d667ef40f 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.caddyfiletest
@@ -42,7 +42,7 @@
"handler": "static_response",
"headers": {
"Location": [
- "{http.request.orig_uri.path}/"
+ "{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"
]
},
"status_code": 308
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.caddyfiletest b/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.caddyfiletest
index e5b331e31..0d20ada2f 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.caddyfiletest
@@ -33,7 +33,7 @@ php_fastcgi @test localhost:9000
"handler": "static_response",
"headers": {
"Location": [
- "{http.request.orig_uri.path}/"
+ "{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"
]
},
"status_code": 308
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_subdirectives.caddyfiletest b/caddytest/integration/caddyfile_adapt/php_fastcgi_subdirectives.caddyfiletest
index a04d66fe4..37d1b71ae 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_subdirectives.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_subdirectives.caddyfiletest
@@ -43,7 +43,7 @@ php_fastcgi localhost:9000 {
"handler": "static_response",
"headers": {
"Location": [
- "{http.request.orig_uri.path}/"
+ "{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"
]
},
"status_code": 308
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.caddyfiletest b/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.caddyfiletest
index a3381f675..f9202f954 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.caddyfiletest
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.caddyfiletest
@@ -46,7 +46,7 @@ php_fastcgi localhost:9000 {
"handler": "static_response",
"headers": {
"Location": [
- "{http.request.orig_uri.path}/"
+ "{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"
]
},
"status_code": 308
diff --git a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
index 5dd19d210..1025fcd35 100644
--- a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
+++ b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
@@ -343,7 +343,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error
}
redirHandler := caddyhttp.StaticResponse{
StatusCode: caddyhttp.WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
- Headers: http.Header{"Location": []string{"{http.request.orig_uri.path}/"}},
+ Headers: http.Header{"Location": []string{"{http.request.orig_uri.path}/{http.request.uri.prefixed_query}"}},
}
redirRoute := caddyhttp.Route{
MatcherSetsRaw: []caddy.ModuleMap{redirMatcherSet},