简体   繁体   English

无法访问HTTP响应中的自定义标头

[英]Unable to access a custom header in HTTP response

I have a node js server in which i am setting a custom header. 我有一个节点js服务器,我在其中设置自定义标头。 To allow it to be accessed by browser i have set Access-control-expose-header. 为了允许浏览器访问它,我设置了Access-control-expose-header。 Using this i am able to get the header in Chrome Firefox but it is giving a error in Phantomjs "Refused to get unsafe header". 使用此工具,我可以在Chrome Firefox中获取标头,但Phantomjs中出现错误“拒绝获取不安全的标头”。 How can i get around this? 我该如何解决?

To get around this you need to set 'webSecurityEnabled' header as 'false' in options while opening a page using PhantomJs. 为了解决这个问题,您需要在使用PhantomJs打开页面时在选项中将'webSecurityEnabled'标头设置为'false'。

Checkout the options listed here https://github.com/nathanboktae/mocha-phantomjs#usage 检出此处列出的选项https://github.com/nathanboktae/mocha-phantomjs#usage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法访问 Set-cookie 响应标头和/或 cookie 请求标头 - Unable to access Set-cookie response header and/or cookie request header Angular.js说自定义HTTP响应头是null - Angular.js saying custom HTTP response header is null 如何从SAPUI5中的HTTP响应中获取自定义标头? - How to fetch custom header from HTTP response in SAPUI5? 无法从Ajax getAllResponseHeaders获取自定义HTTP标头响应 - Can't Get Custom HTTP Header Response from Ajax getAllResponseHeaders 如何在Azure函数的响应中添加自定义http标头 - How to add custom http header in response from Azure function 添加http响应头 - adding http response header 无法从自定义 Rails API 使用 React 访问 response.status - Unable to access response.status with React from a custom rails API Ajax响应中缺少HTTP标头 - Missing http header in Ajax response 请求的资源上不存在“Access-Control-Allow-Origin”标头。 响应的 HTTP 状态代码为 405 - No 'Access-Control-Allow-Origin' header is present on the requested resource. The response had HTTP status code 405 请求的资源上没有“Access-Control-Allow-Origin”标头+响应具有HTTP状态代码401 - No 'Access-Control-Allow-Origin' header is present on the requested resource + The response had HTTP status code 401
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM