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

Use $is_args variable for appending query parameters when configuring Rewrites. #2980

Closed
salonichf5 opened this issue Jan 6, 2025 · 1 comment
Assignees
Labels
area/nginx-configuration Relates to nginx configuration

Comments

@salonichf5
Copy link
Contributor

Is your enhancement request related to a problem? Please describe.

We currently use ? to add query params for URLRewrite. Nginx provides a flag to verify if query params exist called $is_args. We should be making use of the $is_args instead of ? to make standardize.

What would you like to be added:
Use the $is_args variable for adding query params to a URL instead of ? when creating rewrites

Why this is needed:
To use standard variables for evaluating urls

@salonichf5 salonichf5 added the enhancement New feature or request label Jan 6, 2025
@salonichf5 salonichf5 self-assigned this Jan 6, 2025
@sjberman sjberman added area/nginx-configuration Relates to nginx configuration and removed enhancement New feature or request labels Jan 6, 2025
@salonichf5
Copy link
Contributor Author

Closing this story as won't do since after initial investigation, we cannot use $is_args for rewrite filters as it leads to encoding the special character. Mentioning ? explicitly works best in case of rewrites since args get pre-processed multiple times before return is done.

with the ? explicitly mentioned, it results in

curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com/:$GW_PORT/latte/prices\?test\=v1 --include
Handling connection for 8080
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 07 Jan 2025 19:17:17 GMT
Content-Type: text/plain
Content-Length: 169
Connection: keep-alive
Expires: Tue, 07 Jan 2025 19:17:16 GMT
Cache-Control: no-cache

Server address: 10.244.0.80:8080
Server name: coffee-6db967495b-lrglc
Date: 07/Jan/2025:19:17:17 +0000
URI: /prices?test=v1
Request ID: 1db21172fa5e64770dfcaf3f0ad3f1c8

with $is_args it results in

curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com/:$GW_PORT/latte/prices\?test\=v1 --include
Handling connection for 8080
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 07 Jan 2025 19:17:17 GMT
Content-Type: text/plain
Content-Length: 169
Connection: keep-alive
Expires: Tue, 07 Jan 2025 19:17:16 GMT
Cache-Control: no-cache

Server address: 10.244.0.80:8080
Server name: coffee-6db967495b-lrglc
Date: 07/Jan/2025:19:17:17 +0000
URI: /prices%3Ftest=v1
Request ID: 1db21172fa5e64770dfcaf3f0ad3f1c8

@salonichf5 salonichf5 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NGINX Gateway Fabric Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/nginx-configuration Relates to nginx configuration
Projects
Status: Done
Development

No branches or pull requests

2 participants