How to add CORS #15310
-
Version: 3.4.5 Issue: I add Twilio in composer.json. In the URL in production https://clicksseeker.com/register/agency I create an user to receive 6 digits to valid my email registration; but, I receive an error from CORS .
My doubt is how to add CORS headers in phalcon; whatever, code on index.php or adding a specific .htaccess. Thanks. Images for reference, I create a ticket in Twilio and finally receive an answer where the problem is from CORS |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You mean it? I did a test on your website, suppose that you use phalcon on the api, just put it in response.
You can do with .htaccess, i think is your case.
|
Beta Was this translation helpful? Give feedback.
-
I use a listener for it in some project's
On services
|
Beta Was this translation helpful? Give feedback.
-
What I recommend is to add this to nginx's server block:
|
Beta Was this translation helpful? Give feedback.
-
@tidytrax @DrJLT I use this: #15310 (comment) into services.php and no works in https://panel.clicksseeker.com Finally I saw that works in nginx, so would you like to see the nginx file?. This file is localted in /etc/nginx/sites-available/ directory with the name |
Beta Was this translation helpful? Give feedback.
You mean it?
I did a test on your website, suppose that you use phalcon on the api, just put it in response.
$this->response->setHeader('Access-Control-Allow-Origin', '*');
https://docs.phalcon.io/4.0/pt-br/response#headers
You can do with .htaccess, i think is your case.