Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support custom response headers #879

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/http-server
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (argv.h || argv.help) {
' -p --port Port to use. If 0, look for open port. [8080]',
' -a Address to use [0.0.0.0]',
' -d Show directory listings [true]',
' -H --headers add response headers e.g.: --headers=Cross-Origin-Opener-Policy:same-origin',
' -i Display autoIndex [true]',
' -g --gzip Serve gzip files when possible [false]',
' -b --brotli Serve brotli files when possible [false]',
Expand Down Expand Up @@ -138,6 +139,7 @@ else {

function listen(port) {
var options = {
H: argv.headers || argv.header || argv.H,
root: argv._[0],
cache: argv.c,
timeout: argv.t,
Expand Down
1 change: 1 addition & 0 deletions lib/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function HttpServer(options) {
}

before.push(httpServerCore({
H: options.H,
root: this.root,
cache: this.cache,
showDir: this.showDir,
Expand Down