-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Feature Request
- [ ] bug report -> please search issues before submitting
- [ x ] feature request
Versions.
@angular/cli: 1.0.0
node: 6.9.4
os: win32 x64
@angular/animations: 4.0.1
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/platform-server: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
Repro steps.
Attempt to add an extra HTTP header to the webpack dev server that is passed on to proxy requests.
The log given by the failure.
n/a
Desired functionality.
Allow the definition of proxy headers in "proxy.config.json" and add them to proxied requests through the bypass function.
Example:
{
"/api": {
"target": "http://localhost:8080",
"secure": false,
"headers": {
"x-custom-thing": "mySpecialValue"
},
"pathRewrite": {"^/api" : ""}
}
}
Mention any other details that might be useful.
On line 154 of the serve task, we could add something like the following:
if (proxyConfig.headers) {
webpackDevServerConfiguration.proxy.bypass = (req, res, proxyOptions) => {
// loop through the headers defined in the proxy config
// req.headers[proxyHdrKey] = proxyHdrValue;
};
}
We would also have to remove the proxyConfig.headers value before setting the IWebpackDevServerConfigurationOptions.proxy option (e.g. create a copy of the proxy headers before creating the dev server and call delete proxyConfig.headers;.
Metadata
Metadata
Assignees
Labels
No labels