-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Access blocked by CORS / missing headers #923
Comments
To me it looks like this change introduced the problem: #896 When I revert the change made in file Basically I require these lines otherwise no access headers are sent: $origin = '*';
if (!empty($_SERVER['HTTP_ORIGIN'])) {
$origin = $_SERVER['HTTP_ORIGIN'];
}
$response = new JsonResponse($output);
$response->headers->set('Access-Control-Allow-Origin', $origin);
$response->headers->set('Access-Control-Allow-Credentials', 'true');
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
$response->headers->set('Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token'); |
This is a quick step-by-step guide to reproduce the error. 1) 2)
3) 4) |
Hello @klickparkdominik , Does enabling/disabling it make a difference? |
Hi @mcop1 , thank you for checking and confirming. When reporting the initial issue above, no Setting |
Thanks for the answer, helps a lot. I will provide a pull request that fixes the problem when the cache isn´t enabled and link it here. |
Resolved by #925 |
Expected behavior
When accessing Pimcore objects via datahub (graphql) I expect to get a valid response without CORS error.
Actual behavior
I get the following error:
Access to fetch at 'https://domainA.com/pimcore-graphql-webservices/myid?apikey=1337' from origin 'https://domainB.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Steps to reproduce
I access Pimcore objects via datahub (graphql) from my VueJS application.
Pimcore is running on:
domainA.com
Frontend is running on:
domainB.com
This issue started happening after the update to version
1.8.3
.Right now we are on version
1.9.0
.This issue is happening when Pimcore is set to environment
dev
andproduction
no matter what.Rebuilding workspaces and clearing cache does not resolve the problem.
I should maybe note that we use a self-hosted pimcore.
The text was updated successfully, but these errors were encountered: