Encoded Graphql persistent query not working in dispatcher | Community
Skip to main content
ravir73578276
Level 3
June 21, 2023
Solved

Encoded Graphql persistent query not working in dispatcher

  • June 21, 2023
  • 2 replies
  • 864 views

I have a following graphql persistent query

https://myapp/graphql/execute.json/myproject/productInfoByPath;country%3DIndia%3Bpath%3D%2Fcontent%2Fdam%2Fproducts%2F1714526

When I try to hit this url via AMS dispatcher it reconstructs the url to 

https://myapp/graphql/execute.json/myproject/productInfoByPath;country=India;path=/content/dam/products/171231

Due to which the query is returning 500 error.

What configuration I should do in AMS dispatcher so that url doesn't gets decoded?

I have even added "AllowEncodedSlashes On" in the virtual host file.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Tanika02

Hello @ravir73578276  - 

 

Please try making the following changes to the dispatcher.any file : 

 

Add the pass_error flag to the /filter section:

  • Inside the dispatcher.any file, locate the /filter section.
  • Add the pass_error flag to the /filter section as shown below:

 

 

/filter { /0001 { /type "allow" /url "/graphql" /pass_error "0" } }

 

 

By adding the pass_error flag with a value of "0" to the /filter section specifically for the /graphql URL, you're instructing the AMS Dispatcher to preserve the encoded URL without decoding it.

 

NOTE - 

 

Do not forget to restart your Dispatcher post making the above changes.

2 replies

Tanika02
Tanika02Accepted solution
Level 7
June 21, 2023

Hello @ravir73578276  - 

 

Please try making the following changes to the dispatcher.any file : 

 

Add the pass_error flag to the /filter section:

  • Inside the dispatcher.any file, locate the /filter section.
  • Add the pass_error flag to the /filter section as shown below:

 

 

/filter { /0001 { /type "allow" /url "/graphql" /pass_error "0" } }

 

 

By adding the pass_error flag with a value of "0" to the /filter section specifically for the /graphql URL, you're instructing the AMS Dispatcher to preserve the encoded URL without decoding it.

 

NOTE - 

 

Do not forget to restart your Dispatcher post making the above changes.

aanchal-sikka
Community Advisor
Community Advisor
June 21, 2023

hello @ravir73578276 

 

Please refer to https://stackoverflow.com/questions/4390436/need-to-allow-encoded-slashes-on-apache 

 

Issue 2: Apache decodes the encoded slashes

Solution: AllowEncodedSlashes NoDecode (Requires Apache 2.3.12+)

Aanchal Sikka