Re: [Catalyst] Access-Control-Allow-Origin

2018-06-19 Thread Scott Thomson
If you have a front end web server then you can let it handle the CORS for you and don't worry about it in your app, I've used the approach in https://awesometoast.com/cors/ with success for apache, I've heard it's also pretty straightforward for nginx. This way you avoid a full catalyst request

Re: [Catalyst] Access-Control-Allow-Origin

2018-06-18 Thread João André Simioni
I use the following code to allow all origins: $c->response->header('Access-Control-Allow-Origin' => $c->req->header('origin')); $c->response->header('Access-Control-Allow-Methods' => 'GET,POST,OPTIONS'); $c->response->header('Access-Control-Allow-Headers' =>

Re: [Catalyst] Access-Control-Allow-Origin

2018-06-18 Thread Theo Bot
David, It is routed to the default en routine: sub end :ActionClass('RenderView') { my($self,$c) = @_; } On Fri, Jun 15, 2018 at 3:07 PM, David Dorward wrote: > cOn 15 Jun 2018, at 13:54, Theo Bot wrote: > >> Can anybody tell me to to add an "Access-Control-Allow-Origin" in the >>

Re: [Catalyst] Access-Control-Allow-Origin

2018-06-16 Thread Theo Bot
On Fri, Jun 15, 2018, 15:25 David Dorward wrote: > cOn 15 Jun 2018, at 13:54, Theo Bot wrote: > > Can anybody tell me to to add an "Access-Control-Allow-Origin" in the > > header: > > > > I've tried "$c->response->header('Access-Control-Allow-Origin' => > > '*'); > > That's how you do it. > > >

Re: [Catalyst] Access-Control-Allow-Origin

2018-06-15 Thread Dimitar Petrov
You can also consider using a Plack middleware: https://metacpan.org/pod/Plack::Middleware::CrossOrigin Cheers, -- Dimi On Fri, Jun 15, 2018 at 3:07 PM, David Dorward wrote: > cOn 15 Jun 2018, at 13:54, Theo Bot wrote: > >> Can anybody tell me to to add an "Access-Control-Allow-Origin" in the

Re: [Catalyst] Access-Control-Allow-Origin

2018-06-15 Thread David Dorward
cOn 15 Jun 2018, at 13:54, Theo Bot wrote: Can anybody tell me to to add an "Access-Control-Allow-Origin" in the header: I've tried "$c->response->header('Access-Control-Allow-Origin' => '*'); That's how you do it. But I don't see it in the response Is that line of code actually running

[Catalyst] Access-Control-Allow-Origin

2018-06-15 Thread Theo Bot
Hi Can anybody tell me to to add an "Access-Control-Allow-Origin" in the header: I've tried "$c->response->header('Access-Control-Allow-Origin' => '*'); But I don't see it in the response -- Kind regards Theo Bot ___ List: