Apache 405方法不允许-但设置了访问控制允许方法

Apache 405方法不允许-但设置了访问控制允许方法,apache,.htaccess,cors,Apache,.htaccess,Cors,在.htaccess中,我将Access Control Allow Methods设置为GET、POST、OPTIONS、DELETE、PUT,但在响应标题中,我可以看到Allow标题,其中只有POST、DELETE、GET(参见屏幕截图) 如何设置Allow标题以接受选项和PUT 这是我的.htaccess: Header add Access-Control-Allow-Origin "*" Header add Access-Control-Allow-Methods: "GET,POS

在.htaccess中,我将
Access Control Allow Methods
设置为
GET、POST、OPTIONS、DELETE、PUT
,但在响应标题中,我可以看到
Allow
标题,其中只有
POST、DELETE、GET
(参见屏幕截图)

如何设置
Allow
标题以接受
选项
PUT

这是我的
.htaccess

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header add Access-Control-Allow-Headers: "Content-Type"

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Prevent directory listing
Options -Indexes -MultiViews

<FilesMatch "\.(yml|db|twig|md)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
  </IfModule>
</FilesMatch>

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule cache/ - [F]

  # Some servers require the RewriteBase to be set. If so, set to the correct folder.
  # RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ ./index.php [L]

</IfModule>
标题添加访问控制允许来源“*
标题添加访问控制允许方法:“获取、发布、选项、删除、放置”
标题添加访问控制允许标题:“内容类型”
#设置默认处理程序。
DirectoryIndex.php index.html index.htm
#防止目录列表
选项-索引-多视图
要求全部拒绝
命令拒绝,允许
全盘否定
重新启动发动机
重写规则缓存/-[F]
#某些服务器要求设置重写库。如果是,请设置为正确的文件夹。
#重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}=/图标文件
重写规则^./index.php[L]
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header add Access-Control-Allow-Headers: "Content-Type"

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Prevent directory listing
Options -Indexes -MultiViews

<FilesMatch "\.(yml|db|twig|md)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
  </IfModule>
</FilesMatch>

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule cache/ - [F]

  # Some servers require the RewriteBase to be set. If so, set to the correct folder.
  # RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ ./index.php [L]

</IfModule>