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

option to set response headers, specially for CORS #43

Closed
millermedeiros opened this issue Sep 28, 2013 · 3 comments · Fixed by #87
Closed

option to set response headers, specially for CORS #43

millermedeiros opened this issue Sep 28, 2013 · 3 comments · Fixed by #87

Comments

@millermedeiros
Copy link

I'm developing locally and need multiple servers running on different ports, so XHR doesn't work (different port is also blocked by same-origin policy).

I want to simply add Access-Control-Allow-Origin: * to the response header but other users might have different needs so I'm thinking on a new option to set the custom headers:

http-server --header 'Access-Control-Allow-Origin: *; X-Foo: Bar; X-Lorem: Ipsum; ...'

and also and alias for Access-Control-Allow-Origin: *:

http-server --cors

If you agree I can implement this feature and ask for a pull request next week.

@mmalecki
Copy link
Contributor

mmalecki commented Oct 1, 2013

This sounds awesome, would love a pull request.

dtao added a commit to dtao/http-server that referenced this issue Nov 12, 2013
indexzero pushed a commit that referenced this issue Dec 6, 2013
@jorgeas80
Copy link

I'm trying this option, but doesn't seem to work for me: http://stackoverflow.com/questions/24083329/angularjs-cannot-send-post-request-with-appropiate-cors-headers. Am I doing something wrong?

@paulmelnikow
Copy link
Contributor

I seem to have the same problem as @jorgeas80. --cors seems to swallow the first word that comes right after it. I can work around the problem by using --cors foo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants