question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to set cors headers?

See original GitHub issue

I want to set cors header Access-Control-Allow-Origin: *.mydomain.com

How can it be set? Tried with --cors, but not able to set. --cors='Access-Control-Allow-Origin: *.mydomain.com'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

57reactions
bardiarastincommented, Aug 19, 2017

@gagan-bansal @jeffbroadhurst18 use : http-server --cors='*'

11reactions
derhuerstcommented, Oct 10, 2016

With --cors:

< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Range

With --cors=Foo:

< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Range, Foo

It doesn’t seem to work with --cors foo.

With --cors=Foo,Bar:

< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Range, Foo, Bar
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, ...
Read more >
CORS Tutorial: A Guide to Cross-Origin Resource Sharing
When a server has been configured correctly to allow cross-origin resource sharing, some special headers will be included. Their presence can be ...
Read more >
How does the 'Access-Control-Allow-Origin' header work?
The CORS standard describes new HTTP headers which provide browsers and servers a way to request remote URLs only when they have permission....
Read more >
Add CORS headers to server configuration - Docs - MOTECH
CORS headers are set for you when making invocations to the server. Here you can find more information about it the HTTP request...
Read more >
Authoritative guide to CORS (Cross-Origin Resource Sharing ...
Response HeadersPermalink ; Access-Control-Allow-Origin, https://www.mydomain.com, The allowed origins for this request as specified by the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found