Add ability to configure CORS header (#1345)

## Issue Addressed

https://github.com/sigp/lighthouse/issues/1177

## Proposed Changes

Add a command line option (`--http-allow-origin`) and a config item for configuring the `Access-Control-Allow-Origin` response header.  This should unblock making XMLHttpRequests.
This commit is contained in:
Adam Szkoda
2020-07-16 07:23:14 +00:00
parent 4a01f44206
commit fc5e6cbbb0
9 changed files with 210 additions and 152 deletions

View File

@@ -161,6 +161,14 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.default_value("5052")
.takes_value(true),
)
.arg(
Arg::with_name("http-allow-origin")
.long("http-allow-origin")
.value_name("ORIGIN")
.help("Set the value of the Access-Control-Allow-Origin response HTTP header. Use * to allow any origin (not recommended in production)")
.default_value("")
.takes_value(true),
)
/* Websocket related arguments */
.arg(
Arg::with_name("ws")