添加 Header 设置 Access-Control-Allow-Methods 到 Htaccess 时出现内部服务器错误
Internal Server Error when add Header set Access-Control-Allow-Methods to Htaccess
我想通过 htaccess 为我的网站添加授权。
我添加了这段代码:
# BEGIN Cache-Control Headers
<ifmodule mod_headers.c>
Header set Access-Control-Allow-Origin: https://www.example.com
Header set Access-Control-Allow-Headers: Special-Request-Header
Header set Access-Control-Allow-Credentials: true
Header set Access-Control-Max-Age: 240
</ifmodule>
# END Cache-Control Headers
但是当我尝试添加以下行时网站给出 Internal Server Error
:
Header set Access-Control-Allow-Methods: PUT, POST, OPTIONS
需要特殊授权还是语法错误?
尝试使用“”:
Header set Access-Control-Allow-Methods "PUT, POST, OPTIONS"
我想通过 htaccess 为我的网站添加授权。
我添加了这段代码:
# BEGIN Cache-Control Headers
<ifmodule mod_headers.c>
Header set Access-Control-Allow-Origin: https://www.example.com
Header set Access-Control-Allow-Headers: Special-Request-Header
Header set Access-Control-Allow-Credentials: true
Header set Access-Control-Max-Age: 240
</ifmodule>
# END Cache-Control Headers
但是当我尝试添加以下行时网站给出 Internal Server Error
:
Header set Access-Control-Allow-Methods: PUT, POST, OPTIONS
需要特殊授权还是语法错误?
尝试使用“”:
Header set Access-Control-Allow-Methods "PUT, POST, OPTIONS"