You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "dileep-ehr (via GitHub)" <gi...@apache.org> on 2026/02/02 11:26:43 UTC

[I] bug: APIsix returns error when "|" is used in query params [apisix]

dileep-ehr opened a new issue, #12960:
URL: https://github.com/apache/apisix/issues/12960

   ### Current Behavior
   
   We are trying to use APisix as a gateway for our FHIR server. FHIR searches can include "|' in their query params like below
   `/ehrn/abdmc/v1/nhcxtest/Task?identifier=http://hospital.com/trace-ids|TRC-998877`
   
   But I am getting error as below 
   
   `115.99.165.197 - - [23/Jan/2026:16:05:53 +0530] <server url> "GET /ehrn/abdmc/v1/nhcxtest/Task?identifier=http://hospital.com/trace-ids%7CTRC-998877 HTTP/1.1" 400 435 0.023 "-" "PostmanRuntime/7.49.1" 172.21.10.9:8080 400 0.001 "<serverurl>/fhir/nhcxtest/Task?identifier=http://hospital.com/trace-ids%7CTRC-998877"`
   
   From my exploration, I think the issue is because Apisix is not decoding the encoded special characters in the queryparam, while it does decode the ones in the uri, before forwarding to FHIR server, which receives the request parameter with the encoded "|"
   
   ### Expected Behavior
   
   The special characters in the query params encoded by https clients should be decoded like the ones in uris, before forwarding to the backend services
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Run apisix in docker
   2. Run HAPI fhir server in docker
   3. Create a route to the FHIR server
   4. Send a search using queryparams containing '|"
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: APIsix returns error when "|" is used in query params [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #12960: bug: APIsix returns error when "|" is used in query params
URL: https://github.com/apache/apisix/issues/12960


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: APIsix returns error when "|" is used in query params [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12960:
URL: https://github.com/apache/apisix/issues/12960#issuecomment-3869161793

   In the HTTP protocol (RFC 3986), the character `|` is considered unsafe and should be encoded as %7C in URLs. APISIX forwarding %7C itself is standard-compliant and correct behavior. You may refer to the discussions in #7386 and #9638.
   
   For the current version, you can temporarily use the serverless plugin and proxy-rewrite plugin to resolve this issue. Refer to the configuration below:
   
   ```
   {
       "plugins": {
           "serverless-pre-function": {
               "phase": "rewrite",
               "functions": [
                   "return function(conf, ctx) local args = ngx.var.args; if args and args:find('%%7C') then ngx.var.args = args:gsub('%%7C', '|') end end"
               ]
           },
           "proxy-rewrite": {
               "uri": "$uri"
           }
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: APIsix returns error when "|" is used in query params [apisix]

Posted by "dileep-ehr (via GitHub)" <gi...@apache.org>.
dileep-ehr commented on issue #12960:
URL: https://github.com/apache/apisix/issues/12960#issuecomment-3869388297

   @Baoyuantop Thanks. Will try your suggestion and revert


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: APIsix returns error when "|" is used in query params [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12960:
URL: https://github.com/apache/apisix/issues/12960#issuecomment-3869162779

   If there is still a problem, please open it again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org