Repository navigation
How to enable CORS? #95
Answered
by
kraih
francelwebdev
asked this question in
Q&A
Replies: 3 comments 3 replies
|
There are several plugins on CPAN or you can set the headers yourself |
2 replies
|
If you hadn't left IRC so abruptly i would have given you a more detailed explanation than you got until then. CORS is just a bunch of headers you could set like To enable CORS indiscriminately for all routes you could just add this hook to your application: app.addContextHook('router:before', async ctx => {
ctx.res.set('Access-Control-Allow-Origin', '*');
}); |
1 reply
Answer selected by
kraih
|
Hi, how to set cors with multiple domain ? Thanks |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you hadn't left IRC so abruptly i would have given you a more detailed explanation than you got until then. CORS is just a bunch of headers you could set like
ctx.res.set('Access-Control-Allow-Origin', '*');. Ideally you would implement CORS as router conditions in an NPM plugin. We have a bunch for Perl already, porting one of them should be very easy.To enable CORS indiscriminately for all routes you could just add this hook to your application: