Skip to content

请问HTTP OPTIONS 返回 405 Not Allowed是怎么回事? #27

@ghost

Description

当我进行跨域请求时(OPTIONS方法),就会提示我 405 Not Allowed,感觉在PHP中设置的header并没有起作用。我想肯定时nginx拦截了请求。但是假如我自己修改nginx配置的话,那肯定没有PHP header函数方便。我想问下,咱们的demo网站是如何处理这个问题的?因为我看到咱们也是用的Ngxin。希望得到回答,谢谢~

下面是我在本地使用telnet模拟发送http options 请求得到的结果:

OPTIONS / HTTP/1.1
Host: www.test.com

HTTP/1.1 405 Not Allowed
Server: nginx
Date: Mon, 07 May 2018 09:11:50 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive

<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions