Skip to content

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
Member

@paulmelnikow can you rebase off master?

@paulmelnikow
Copy link
Contributor Author

done

@indexzero
Copy link
Member

@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
Member

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