zeuxisoo / php-slim-whoops

PHP whoops error on slim framework
132 stars 10 forks source link

CORS headers not set #34

Open killua-eu opened 2 years ago

killua-eu commented 2 years ago

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 https://github.com/filp/whoops/issues/666 ... I'd basically need to extend the PrettyPageHandler ... I guess that

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

zeuxisoo commented 2 years ago

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

I hope my answer can solve your concern.