markhuot / craftql

A drop-in GraphQL server for Craft CMS
Other
320 stars 53 forks source link

Error: 301 Moved permanently / Unable to verify your data submission #310

Closed Jones-S closed 5 years ago

Jones-S commented 5 years ago

I have a craft installation together with craftql. Since a short time I cannot only not query within the CP graphiql window – I would get this error: Unable to verify your data submission – but also the $ curl command fails with the message: 301 Moved permanently.

I uninstalled CraftQL and reinstalled it, added a new token etc. But still always the same error.

I don't have any idea what could have caused this...

Any ideas? Could it be related to some csrf stuff?

image

Edit: I changed the sites Base Url (for preview reasons) and added this to the config:

return [
    '*' => [
        'enableCsrfProtection' => false,
    ]
]

(I am not sure if this is super bad)

Anyway it did not help: And now I would get this error TypeError: NetworkError when attempting to fetch resource.

image
Jones-S commented 5 years ago

Ok, I see a solution for the second problem now. If I change 'siteUrl'=> getenv('FRONTEND_URL'), back to 'siteUrl'=> getenv('DEFAULT_SITE_URL'), it works again on my local setup.

But I need the siteUrl to be set to my frontend url because the preview should open the iframe with my frontend url (headless setup)...

Any ideas why the first problem appeared and how I could solve my existing problem?

On my remote I now get a new error: Template not found: craftql/mydomain.com/api And if I use my curl command I would still get 301 Moved Permanently

🤦🏼‍♂️ I am getting desperate...

Edit: 🤦🏼‍♂️ I had an error in my .env file. The DEFAULT_SITE_URL missed the https:// part. Would there be a way to debug those things bit quicker?

Jones-S commented 5 years ago

OK this ticket is really confusing. Sorry about that. Just if somebody comes along and tries to find his errors, here are a few pointers where to look for errors:

I hope that helps someone.