0

I'm running a headless Wordpress instance and nginx is routing it to /adminon my website. On Wordpress I have the WPGraphql plugin installed and activated. GraphiQL is working and querying everything correctly, but I get a 404 page not found when clicking on the link ( https://example.com/admin/graphql ) . Instead I expect to see something in JSON format, like: {"errors":[{"message":"GraphQL Request must include at least one of those two parameters: \"query\" or \"queryId\"","extensions":{"category":"request"}}],"extensions":{"debug":[]}}

I suspect this has something to do with my routing in nginx but I haven't been able to figure this one out.

This is my nginx configuration for the route where I'm accessing the Wordpress admin.

location /admin {    
   ​add_header X-Frame-Options SAMEORIGIN;    ​add_header Strict-Transport-Security "max- 
   age=31536000";    
   ​add_header X-Content-Type-Options nosniff;    ​
   add_header X-XSS-Protection "1; mode=block";    
   ​alias /home/lmraza98/wordpress/; ​
   try_files $uri $uri/ /index.php?$args;    ​
   include  /etc/nginx/mime.types;

   ​location ~ \.php$ {
      ​include snippets/fastcgi-php.conf;
      ​fastcgi_param SCRIPT_FILENAME $request_filename;
      ​fastcgi_pass unix:/run/php/php7.4-fpm.sock;    ​
   }

   ​location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
      ​expires max;
      ​log_not_found off;    
   ​}  
​}

4

0 回答 0