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

时间:2021-07-16 12:25:02

I have a node js server in which i am setting a custom header. To allow it to be accessed by browser i have set 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". How can i get around this?

我有一个节点js服务器,我在其中设置自定义标头。为了允许浏览器访问它,我设置了Access-control-expose-header。使用此功能,我可以在Chrome Firefox中获取标题,但它在Phantomjs中发出错误“拒绝获取不安全的标题”。我怎么能绕过这个?

1 个解决方案

#1


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

#1


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