Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM 6.5.17 | Graphql - Persisted query not working in dispatcher

Avatar

Level 2

Hi All,

 

In the author and publish instances the persisted queries working fine. but on the dispatcher, it is not working.

 

n_radhakrishna_0-1698421571852.png

 

I have added the below rules in the rewrite and dispatcher.any files


in rewrite file

 

RewriteCond %{REQUEST_URI} ^/graphql/execute.json
RewriteRule ^/(.*)$ /$1;.json [PT]

 


in dispatcher.any

 

/0060 { /type "allow" /method '(POST|OPTIONS)' /url "/content/_cq_graphql/*/endpoint.json" }
/0061 { /type "allow" /method '(GET|POST|OPTIONS)' /url "/graphql/execute.json*" }

 

 

Thanks,

RadhaKrishna

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi All,

 

The request was going to a different dispatcher and publish instance and I was working on another setup. We added above mentioned rewrite rules and dispatcher rules in our server setup and started working.

 

Thank you all.

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @n_radhakrishna 

 

Can you please try following?

 

Filter

/0502 { /type "allow" /extension "json" /path "/graphql/execute" /method "GET" }

 

Rewrite

RewriteCond %{REQUEST_URI} ^/graphql/execute.json
RewriteRule ^/(.*)$ /$1;.json [PT]

Also, please elaborate what you mean by not working?


Aanchal Sikka

Avatar

Level 2

Hi Anchal,

 

In the publish instance when I access the persisted query, I see JSON response and getting persistence error in the dispatcher, and in the network tab status is 404.

 

screenshot - dispatcher  status 404

n_radhakrishna_0-1698425118856.png

 

screenshot - publish instance  status 200

n_radhakrishna_0-1698424143016.png

 

Avatar

Community Advisor

@n_radhakrishna 

 

Are you executing the query on publish as anonymous user? I mean without a session?


Aanchal Sikka

Avatar

Community Advisor

@n_radhakrishna 

 

As @Mahedi_Sabuj  suggested, update these variables to get detailed logs

 

Define DISP_LOG_LEVEL debug
Define REWRITE_LOG_LEVEL trace2

Aanchal Sikka

Avatar

Community Advisor

Hi @n_radhakrishna, It seems like the request is being blocked by filters. To identify which filter rules are causing this, I suggest reviewing the dispatcher.log where you should be able to pinpoint the specific filter rules responsible for blocking the request.

Avatar

Correct answer by
Level 2

Hi All,

 

The request was going to a different dispatcher and publish instance and I was working on another setup. We added above mentioned rewrite rules and dispatcher rules in our server setup and started working.

 

Thank you all.