mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 11:22:56 +00:00
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:
@@ -38,6 +38,9 @@ pub struct Config {
|
||||
pub listen_address: Ipv4Addr,
|
||||
/// The port the REST API HTTP server will listen on.
|
||||
pub port: u16,
|
||||
/// If something else than "", a 'Access-Control-Allow-Origin' header will be present in
|
||||
/// responses. Put *, to allow any origin.
|
||||
pub allow_origin: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -46,6 +49,7 @@ impl Default for Config {
|
||||
enabled: false,
|
||||
listen_address: Ipv4Addr::new(127, 0, 0, 1),
|
||||
port: 5052,
|
||||
allow_origin: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user