Skip to content
Advertisement

Connection refused for Sanity API call

I’m using the sanity php client to fetch some data off of sanity.

This is my query:

JavaScript

This is the error I’m getting:

JavaScript

The odd thing is: everything works fine in my local dev environment. but testing this on the webserver results in the error. I added the CORS origins so both localhost and the Webserver are allowed to connect to sanity. php versions are the same.

Advertisement

Answer

I set up a .htaccess so the webserver php parses html files. Apparently Guzzle didn’t like that. When I changed my files to .php everything worked as expected.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement