Firefox不接受Access-Control-Allow-Origin:* [英] Firefox does not accept Access-Control-Allow-Origin: *

查看:1349
本文介绍了Firefox不接受Access-Control-Allow-Origin:*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想允许访问我服务器上的所有来源,但我的AJAX请求来自

解决方案

如果你只想让你的firefox启用CORS:

https://addons.mozilla.org/fr/firefox/addon/cors-everywhere/


I want to allow access to all origins on my server, but my AJAX requests from http://localhost:8100/ in Firefox keep being rejected.

header("Access-Control-Allow-Origin: *"); // allow the use of requests in development (ionic serve in web browser).
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Max-Age", "3600");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");;

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://my-domain.com/userLogin. (Reason: CORS header 'Access-Control-Allow-Origin' does not match '*')."

Firefox seems NOT to understand that the "*" character as a "wildcard" origin (and not to be taken literally as the origin). If I change the header as below, this works perfectly.

header("Access-Control-Allow-Origin: http://localhost:8100");

Any idea why Firefox won't accept the "*"?

解决方案

In the case you just want YOUR firefox to enable CORS :
https://addons.mozilla.org/fr/firefox/addon/cors-everywhere/

这篇关于Firefox不接受Access-Control-Allow-Origin:*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆