这个问题将是我的死。无论如何,我都试图解决为什么spatie / cors软件包在本地可以使用但无法在生产中使用的麻烦。如果有人有经验,我将不胜感激!我正在尝试访问我的后端,但收到警报说
my url has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request
答案 0 :(得分:0)
您的URL https://aewcpa.traxit.pro/api/account
正在针对CORS https://traxit.pro/api/account
请求返回到OPTIONS
的301重定向,这导致了此问题。
您可以在浏览器的网络控制台中或通过cURL看到此操作:
curl -I 'https://aewcpa.traxit.pro/api/account' -X OPTIONS -H 'Access-Control-Request-Method: GET' -H 'Referer: https://aewcpa.traxit.io/login' -H 'Origin: https://aewcpa.traxit.io'
HTTP/2 301
server: nginx/1.15.6
date: Fri, 21 Dec 2018 18:14:36 GMT
content-type: text/html
content-length: 169
location: https://traxit.pro/api/account