kettle11 / devserver

A simple HTTPS server for local development. Implemented in Rust.
zlib License
95 stars 15 forks source link

Allow header configuration #1

Closed Kixiron closed 3 years ago

Kixiron commented 4 years ago

Allow users to configure server headers, either with a command line option, a environmental variable option or a Devserver.toml type of configuration.
Devserver.toml

[headers]
Access-Control-Allow-Origin = "*" # Allow CORS

CLI

devserver --headers Access-Control-Allow-Origin="*"

Env

DEVSERVER_HEADERS="Access-Control-Allow-Origin='*'"

Out of these (In my opinion at least) the config file option seems the best, as it allows further expansion of configuration in the future

kettle11 commented 4 years ago

Sorry for the delayed response!

You're totally right that this should be something devserver can configure. Some new web APIs (like SharedArrayBuffer) won't work unless the server properly configures headers.

The initial implementation should just be with a command line flag as it's most straightforward to implement.

A configuration file can be added later if it feels like it's needed.