我得到了一些我无法上班的东西。 如果我的应用程序进行API调用它通常有效,但由于我搬到了新的服务器,它不断得到cors erros。我已经尝试了各种各样的东西,但却无法让它发挥作用。
请求标题:
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7
Access-Control-Request-Headers:content-type
Access-Control-Request-Method:POST
Connection:keep-alive
Host:api.sced.nl
Origin:https://example.com
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
回复标题:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Accept, Origin, X-Requested-With, Content-Type, Access-Control-Allow-Origin, X-Auth-Token, Authorization
Access-Control-Allow-Methods:GET, POST, PATCH, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:*
allow:POST
Cache-Control:no-cache, private
Connection:Upgrade, close
Content-Encoding:gzip
Content-Length:10233
Content-Type:text/html; charset=UTF-8
Date:Wed, 13 Dec 2017 19:47:22 GMT
Server:Apache/2
Upgrade:h2,h2c
Vary:Accept-Encoding,User-Agent
X-Powered-By:PHP/7.1.12
响应:
Request URL:https://example.com/auth/login
Request Method:OPTIONS
Status Code:405 Method Not Allowed
Remote Address:149.210.134.109:443
Referrer Policy:no-referrer-when-downgrade
我已尝试安装" \ Barryvdh \ Cors \ HandleCors :: class,"包,但这也行不通。