Expand my Community achievements bar.

SOLVED

Encoded Graphql persistent query not working in dispatcher

Avatar

Level 3

I have a following graphql persistent query

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

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/produ...

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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.

Avatar

Community Advisor

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