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

fix: set headers for CORS #9437

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

michalsn
Copy link
Member

Description
This PR fixes a bug where CORS was not set correctly due to the response object being returned in the before filter. Now all CORS headers are set in the before filter, and the after filter is no longer used.

This change should not break anyone's code.

Fixes #9431

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 27, 2025
@kenjis
Copy link
Member

kenjis commented Jan 29, 2025

If a dev creates an new Response in a controller, the CORS header will not be added.
E.g, what if using redirect()?

@michalsn
Copy link
Member Author

If a dev creates an new Response in a controller, the CORS header will not be added.
E.g, what if using redirect()?

Fair point.

@codeigniter4 codeigniter4 deleted a comment from mergeable bot Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Cors filter can not be used with Shield's Token filter together
3 participants