-
Notifications
You must be signed in to change notification settings - Fork 93
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
Setting CORS headers #182
Comments
Did you ever solve this? I’m running into similar problems. |
I have a similar issue POSTing to But I guess this is result of not passing it what it needs as its a bad request. I trying to compose a valid request. |
I know it's an old thread, but for anyone else with the same problem, one way I just solved dealing with the necessary headers for POST requests is to add the header in a custom module: //modules/Module.php
Craft::$app->getResponse()->getHeaders()->set('Access-Control-Allow-Origin', 'http://localhost:2222'); If that's too open for you, I'm sure you could add conditionals to check the type of request, the action, etc. |
We're submitting data to the plugin from a different domain. We're setting the required CORS headers via
.htaccess
(so the OPTIONS request goes through) but Craft seems to remove them from the actual POST request, which seems to be a problem for Axios.The way I see it there is no way of overriding the controller to add headers to the response. Any hints as to how to approach this?
Thanks!
The text was updated successfully, but these errors were encountered: