New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proxy无法设置header头的问题 #2905
Comments
http不能请求 https接口 |
或许你是要在proxy里加个参数 |
target: 'http://some-host.test:1234',
headers: {
'Host': 'some-host.test'
} 注意要 |
我试了下 headers: {
Host: 'some-host.test'
} 这样也是可以的,主要是 |
🤔️这里你不是应该在axios中配置请求头嘛。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question(提问)
由于后端接口服务器使用的是虚拟主机,所以本地代理服务器的请求头必须携带Host字段。
我根据webpack与http-proxy-middleware文档做了如下配置:
我本地服务是
http://localhost:9530
,我是用postman加上请求头访问类似http://localhost:9530/api/user
的接口可以访问通。但是我配置的header字段不生效,浏览器里面接口请求一直返回308,如图。
Screenshot or Gif(截图或动态图)
Other relevant information(格外信息)
线上服务器是https,我本地localhost是http,不知这个有没有影响。
The text was updated successfully, but these errors were encountered: