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

Explain behavior with raised exceptions #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julik
Copy link
Contributor

@julik julik commented Oct 1, 2021

When an exception gets raised Rack::Cors won't add headers anymore, which leads to the browser not even loading the response. This honors an explanation, as it will likely occur with Rack apps where no default error handler page / middleware is configured.

When an exception gets raised Rack::Cors won't add headers anymore, which leads to the browser not even loading the response. This honors an explanation.
@sandstrom sandstrom mentioned this pull request Mar 2, 2022
@cyu
Copy link
Owner

cyu commented Sep 11, 2022

@julik I'll be honest, I'm not sure what's happening that's preventing the headers from being provided. If you can provide an working example, I'll take a look, fix if I can or document if a fix isn't possible.

@julik
Copy link
Contributor Author

julik commented Sep 12, 2022

The issue here is that of something that Rack::CORS wraps does a raise, the middleware has no control over the Origin header. This means that the response generated by the "error page" application or middleware, whatever it may be, will not contain headers generated by Rack::CORS. I don't think it is possible to resolve, because you can't include the Origin header in the exception - this is not supported by Rack. Hope I am explaining it right?..

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.

None yet

2 participants