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

CORS headers not set #34

Open
killua-eu opened this issue May 14, 2022 · 1 comment
Open

CORS headers not set #34

killua-eu opened this issue May 14, 2022 · 1 comment

Comments

@killua-eu
Copy link

Hey, I switched to using this middleware (and whooops) also for APIs. Endpoints accessed by javascript that encounter an exception get a 500 error message - see discussion in filp/whoops#666 ... I'd basically need to extend the PrettyPageHandler ... I guess that

  • adding support for a variable PrettyPageHandler
  • adding the ability to pass custom headers via a config option
  • or similar

might do the trick. Or do you see another way around?
Thanks

@zeuxisoo
Copy link
Owner

Thank you for your question. Please let me make some assumptions first.

In this case, if you are using the Slim framework on the backend (API) only. The frontend also base on the React, Vue or another frontend library/framework and managed via Webpack/Vite. The frontend application can call the api through the proxy in development environment.

In the production environment, the slim whoops plugin should be disabled by default.

Reference

  • webpack: proxy settings in devServer section.
  • vite: proxy settings in server section.

I hope my answer can solve your concern.

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

No branches or pull requests

2 participants