Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the query strings when redirecting requests #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Scarf/Gateway/Rule/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ redirectOrProxy request domain !capture ResponseBuilder {..}
| shouldRedirectDockerRequest request =
-- As with the Host header we have to respect the proxy protocol
-- when redirecting.
let !absoluteUrl = "https://" <> domain <> Wai.rawPathInfo request
let !absoluteUrl = "https://" <> domain <> Wai.rawPathInfo request <> Wai.rawQueryString request
in redirectTo capture absoluteUrl
| otherwise =
proxyTo (const capture) domain
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions test/golden/docker-test-2.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"capture": "DockerCapture {dockerCaptureImage = [\"library\",\"proxy\"], dockerCaptureReference = \"list\", dockerCaptureBackendRegistry = \"ghcr.io\", dockerCapturePackage = Just \"8717953c-3452-4ef7-9a14-b64dc19163b4\", dockerCaptureAutoCreate = Nothing}",
"headers": {
"Location": "https://ghcr.io/v2/library/proxy/tags/list",
"X-This-Request-Was-Proxied": "1"
},
"query": "?n=10",
"status": 307
}
10 changes: 10 additions & 0 deletions test/golden/docker-test-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
path: /v2/library/proxy/tags/list?n=10
headers:
Host: cr.test.io
manifest:
rules:
- type: docker-v1
repository-name: library/proxy
domain: cr.test.io
registry: ghcr.io
package-id: "8717953c-3452-4ef7-9a14-b64dc19163b4"
Loading