ApacheHTTPD-标头合并忽略现有标头
使用apache mod_proxy 2.5,我试图将现有的access control allow origin标头与proxypass位置中的mod_标头合并或替换。 从代理后端返回的答案已经包含一个我想合并或替换的access control allow origin头ApacheHTTPD-标头合并忽略现有标头,apache,http-headers,access-control,mod-proxy,Apache,Http Headers,Access Control,Mod Proxy,使用apache mod_proxy 2.5,我试图将现有的access control allow origin标头与proxypass位置中的mod_标头合并或替换。 从代理后端返回的答案已经包含一个我想合并或替换的access control allow origin头 Header always merge Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "OPTIONS,
Header always merge Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "OPTIONS, GET"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-smp-appcid"
这将导致标题重复,这将在所有浏览器中引发错误,因为此标题只能出现一次
“始终设置标题”也是一样的,尽管这应该替换现有标题
我还尝试使用if模块首先检查头是否出现,并且仅设置if unset。但不知何故,很难查看响应标题
非常感谢您的帮助我通过设置Access Control Allow Origin和Access Control Allow Credentials头(仅当它是飞行前请求时)解决了相同的问题 第二个请求(POST、DELETE、PUT等)由代理后端(已发送所需的头)处理,它不是飞行前请求,因此Apache规则不会再次设置头 要检查飞行前请求,您可以检查请求是否包含: