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

Prevent allowCrossDomain middleware from sending headers if they're already sent #2417

Closed
wants to merge 1 commit into from

Conversation

sebsylvester
Copy link

This fix solved the issue #2410 for me

This fix solved the issue as described at #2410
@codecov-io
Copy link

codecov-io commented Jul 28, 2016

Current coverage is 91.84% (diff: 100%)

Merging #2417 into master will increase coverage by <.01%

@@             master      #2417   diff @@
==========================================
  Files            95         95          
  Lines         10708      10709     +1   
  Methods        1309       1309          
  Messages          0          0          
  Branches       1741       1742     +1   
==========================================
+ Hits           9835       9836     +1   
  Misses          873        873          
  Partials          0          0          

Powered by Codecov. Last update a957df0...4f30070

@flovilmart
Copy link
Contributor

While this should be working, this is not the correct fix for that issue i believe. The problem comes from the way we mount our routes for the PublicAPIRouter, and the way it falls through to the middlewares after mounting those

@sebsylvester
Copy link
Author

You're right, it's not a clean fix. I wanted to bring the issue to people's attention because I was surprised so few reported the same kind of issue with the sent headers. Shouldn't there be a "headers sent" check between the PublicAPIRouter and the middlewares like allowCrossDomain?

@flovilmart
Copy link
Contributor

flovilmart commented Aug 6, 2016

There are 2 kinds of problems related to the sent headers:

  1. the one you describe on those endpoints, where we want to exit early
  2. When using parse-server as an express module alongside other middlewares

I'm trying to figure out something, as this middleware suite is not supposed to be run at all as the endpoints are not matching after.

See:
https://github.com/expressjs/expressjs.com/pull/580/files

@flovilmart
Copy link
Contributor

Should be fixed by #2475

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