api7 / api7/apisix-nginx-module
feat: allow NGiNX to correctly process `%2F` special character in path parameters
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 45
- Forks
- 25
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
Referenced APISIX issue: https://github.com/apache/apisix/issues/11810
Description
Currently, APISIX with radixtree_uri_with_parameter router doesn't support %2F in path parameters. That's due to how NGiNX processes the request URIs.
Feature Request
Add a NGiNX configuration directive to allow the correct processing of %2F character in URI. This directive, supposedly called decode_percent_characters would work like that:
- by default is set to
on, so that it doesn't change NGiNX default behaviour; - similarly to
merge_slashesdirective, it's passed tongx_http_parse_complex_uri()from src/http/ngx_http_parse.c; - if set to
off, NGiNX doesn't replace percent-encoded characters in request URIs, with their respective decoded values (i.e.%2fdoesn't get decoded to/if we setdecode_percent_characters off;innginx.conf);
Additional Notes
I opened a issue some time ago on NGiNX, with the feature proposal and a possible implementation, but it didn't drag attention: https://github.com/nginx/nginx/issues/501.
Questions
- Do you think that this feature makes sense/could be useful?
- Would it effectively solve the issue, or there's something I'm missing in the request processing and routing pipeline? Would that be the right component to introduce this feature?
- How can I test a possible fix myself? Which file(s) do I have to edit and how can I compile?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/http/ngx_http_parse.c and ngx_http_parse_complex_uri(), comparing the requested behavior with the referenced APISIX issue and NGINX issue #501. Determine how a directive like decode_percent_characters would reach URI parsing and how it could be tested. Done means the default preserves NGINX behavior while off prevents encoded slashes such as %2F from being decoded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, nginx
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100