Angular-cli: Configure custom HTTP headers

Created on 10 May 2017  路  2Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Desired functionality.

I would like to be able to configure webpack server HTTP headers through the angular cli. I am interested in configuring security headers so that I can determine their effects on my project.

Mention any other details that might be useful.

It looks like this could be done very similarly to how the proxy config is passed through to the WebpackDevServer config options. A separate config file could be used or maybe a combined configuration file could be used to hold both proxy and headers settings.

There is an existing request for adding proxy headers (https://github.com/angular/angular-cli/issues/5968) but this request is just for headers in general.

I am interested in contributing this enhancement. Implementation feedback is welcomed.

Most helpful comment

This level of configuration is beyond the scope of ng serve. An alternative is to use ng build --watch and serve the contents of dist with a custom server that implements all the setting you need.

All 2 comments

This level of configuration is beyond the scope of ng serve. An alternative is to use ng build --watch and serve the contents of dist with a custom server that implements all the setting you need.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings