-
Notifications
You must be signed in to change notification settings - Fork 12k
The 'Access-Control-Allow-Origin' header has a value #7571
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
Comments
This is not related to AngularCLI. This is simply CORS built straight into your browser. The error is telling you that your server is setup to allow "http://localhost:4200" (Access-Control-Allow-Origin is part of the response, not request). gh.nhamoigioi.xyz is therefore not allowed to access the server. You need to allow gh.nhamoigioi.xyz instead of localhost:4200 on the server side. |
#2872 canbe help for your problem |
Closing as answered by @grizzm0. |
Hi. If you're using php as your server side, include the lines below in your .php file. it worked for me header('Access-Control-Allow-Origin: *'); |
thank you. but i using nodejs.
i'm success
2017-10-27 14:49 GMT+07:00 Joseph <[email protected]>:
… Hi.
If you're using php as your server side, include the lines below in your
.php file. it worked for me
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE,
OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type,
X-Auth-Token');
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7571 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANNWw3O1XnwobEQFeOtqsEqRrwAekljKks5swYrygaJpZM4PKEDe>
.
--
*Võ Đình Nghĩa - Web Design & Web Developer*
*Phone:* 0166 459 7661
*Email: *[email protected]
*Skype: *dinhnghia.it
|
how did you solve this? |
How did you solve this using Node.js? |
Try adding the following middleware to your NodeJS/Express app (I have added some comments for your convenience) app.use(function (req, res, next) {
}); In case you prefer something shorter, you may use a plugin called cors available for Express.js
|
hello |
can you explain what is the issue:: |
The browser does a preflight OPTIONS request to the server to make sure it's allowed to fetch the data. Read more about CORS. The server at |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
XMLHttpRequest cannot load http://api.nhamoigioi.xyz/locations/districts. The 'Access-Control-Allow-Origin' header has a value 'http://localhost:4200' that is not equal to the supplied origin. Origin 'http://gh.nhamoigioi.xyz' is therefore not allowed access.
The text was updated successfully, but these errors were encountered: