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

Get CORS support working with XHR preflight #88

Merged
merged 1 commit into from
Mar 6, 2015
Merged

Get CORS support working with XHR preflight #88

merged 1 commit into from
Mar 6, 2015

Conversation

paulmelnikow
Copy link
Contributor

Without this patch, http-server returns 404 on the preflight request (method: 'OPTIONS'). You can see the problem by loading an XHR request in Chrome.

@ralyodio
Copy link

I tried your fork and i still get a 404

edit: nevermind, my app was sending Authorization header which was causing it to be rejected

@ralyodio
Copy link

+1 for merging this!

@paulmelnikow
Copy link
Contributor Author

ping @indexzero, can you get this merged?

@indexzero
Copy link
Collaborator

@paulmelnikow can you rebase off master?

@paulmelnikow
Copy link
Contributor Author

done

@indexzero
Copy link
Collaborator

@paulmelnikow read a little closer, there is actually a --cors option in the CLI, but in this implementation the corser middleware is added by default. Can you make it respond to the option? Then I'll merge.

Bonus points if you write tests.

@paulmelnikow
Copy link
Contributor Author

Ah, makes sense. I'll take another pass.

Without this patch, http-server returns 404 on the preflight request (method: 'OPTIONS'). You can see the problem by loading an XHR request in Firefox.
@paulmelnikow
Copy link
Contributor Author

Updated, now honoring the cors option. Includes a test which fails if you remove cors: true. Moved the cors header config into http-server.js so it works in the test.

@indexzero
Copy link
Collaborator

Awesome! Merging. Thanks for writing the tests 💯

indexzero added a commit that referenced this pull request Mar 6, 2015
Get CORS support working with XHR preflight
@indexzero indexzero merged commit 630900f into http-party:master Mar 6, 2015
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 this pull request may close these issues.

3 participants