简体   繁体   English

actionHero.js设置Http标头

[英]actionHero.js Set Http Header

I want to know if there is a way to Set the Http.Header in actionHero.js: in our server we are working with actionHero.js and Go. 我想知道是否可以在actionHero.js中设置Http.Header:在我们的服务器中,我们正在使用actionHero.js和Go。 I need to send on the "Header" two domain name "client domain & mine(actionHero Service)" to the Go service. 我需要将“ Header”两个域名“ client domain&mine(actionHero Service)”发送到Go服务。 or if there is any other way to do it on the Proxy server 或在代理服务器上是否还有其他方法

thank you in advance 先感谢您

assuming you mean the response header to the client, in your actions or initializers you can do: 假设您是指客户端的响应标头,则可以在操作或初始化程序中执行以下操作:

data.connection.rawConnection.responseHeaders.push(['x-my-header', 'abc123'])

If you want to set persistent headers that the server responds to all requests with, you can set those in api.config.servers.web.httpHeaders 如果要设置服务器响应所有请求的持久标头,则可以在api.config.servers.web.httpHeaders进行设置。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM