-
Notifications
You must be signed in to change notification settings - Fork 134
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
PERF: Do not set any caching headers on preflight requests #307
base: main
Are you sure you want to change the base?
Conversation
This will allow each app that uses this library to handle caching behavior of the preflight requests in a way that makes sense for their app on their own CORS middleware.
Yeah I don't think we can do this, there are some headers we want to pass through. |
IMO, we should either do this properly or leave for downstream library consumers. |
I see... how about we then add:
Then we are not leaving people with no way of injecting headers they need into preflight while making the change? I thought @benlangfeld had a reason he wanted headers injected into preflight? |
That's the thing, we already inject headers in the preflight responses at And The problem is removing those. Which is way I'd like for the library to let downstream handle it on their middlewares. |
But we are injecting here: So will the change not break us? MessageBus middlware is way up the stack prior to Discourse::Cors. With:
We will have another place to put headers. At a minimum a good fix would be to force content type after the current callback, cause we know it is not json. |
Yes, that is what my first link in the previous response was about. It's easy to add headers when using MessageBus as a library. Shouldn't we let the apps using it as a library set whatever they see fit, instead of having to remove a bunch of unnecessary or even (in content-type case) incorrect headers? |
My objection to this change as it stands is that it takes the capability to add headers away from me unless I add extra middleware, thus using a different approach from adding headers to any other non-preflight response from MessageBus. It is therefore a breaking change. |
Ohhhhhhh now I get what you meant. Will fix. |
How about now @benlangfeld ? |
I think this could do with some test coverage. It's still a backward incompatible change, so would require a major version bump per semver, but at least it's not a significant inconvenience for users. |
This will allow each app that uses this library to handle caching
behavior of the preflight requests in a way that makes sense for their
app on their own CORS middleware.