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

Add back --cors option #527

Merged
merged 5 commits into from Dec 30, 2019
Merged
Changes from 3 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
6 changes: 6 additions & 0 deletions bin/serve.js
Expand Up @@ -173,6 +173,10 @@ const startEndpoint = (endpoint, config, args, previous) => {
const compress = args['--no-compression'] !== true;

const server = http.createServer(async (request, response) => {
if (args['--cors']) {
response.setHeader('Access-Control-Allow-Origin', '*');
}

if (compress) {
await compressionHandler(request, response);
}
Expand Down Expand Up @@ -344,6 +348,7 @@ const loadConfig = async (cwd, entry, args) => {
'--no-clipboard': Boolean,
'--no-compression': Boolean,
'--symlinks': Boolean,
'--cors': Boolean,
'-h': '--help',
'-v': '--version',
'-l': '--listen',
Expand All @@ -353,6 +358,7 @@ const loadConfig = async (cwd, entry, args) => {
'-n': '--no-clipboard',
'-u': '--no-compression',
'-S': '--symlinks',
'-C': '--cors',
// This is deprecated and only for backwards-compatibility.
'-p': '--listen'
});
Expand Down