Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@odan
Last active May 18, 2020 21:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odan/c3c41fb8b4d6d6b943b79f69aa58f27e to your computer and use it in GitHub Desktop.
Save odan/c3c41fb8b4d6d6b943b79f69aa58f27e to your computer and use it in GitHub Desktop.
Slim 4 - CORS with preflight request
@cnakamoto
Copy link

I spent a lot of time trying to get CORS working with the Slim 4 skeleton app until I discovered the ResponseEmitter class which just lets you add your origin host and takes care of the rest. FYI for anyone else in this situation.

@luisaureliocasoni
Copy link

One thing about preflight requests is: when the preflight request is causing error, check if Authorization Middleware is authenticating OPTIONS routes.

If OPTION route is authenticated, causes on non 2xx requests, making the browser abort the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment