Falcon: add_static_route CORS issue

Created on 1 May 2018  Â·  14Comments  Â·  Source: falconry/falcon

Hello and thank you in advance for your time. I'm using add_static_route to serve static files mainly for testing purposes. In some cases, I want to pull in static files on the front end with Javascript. Currently I'm using CORS middleware on our server and it works great, but does add_static_route bypass falcon middleware? I'm not seeing the CORS headers set in the response from my server. Any help would be appreciative. Thanks!

question

All 14 comments

Hi @dave4jr, the static routes do not bypass middleware components. Perhaps @lwcolton has some thoughts on what might be happening?

Thanks! @lwcolton, I know you are probably super busy, just wanted to see if you would by chance have any insight onto this? The response from add_static_route isn't setting CORS like the other endpoints I create (with the CORS middleware). Is there a reason for this that I'm not thinking about? Probably something obvious. Thanks for your time sir.

I'll look into this today

On Mon, May 21, 2018 at 12:15 AM, Dave Luke Jr notifications@github.com
wrote:

Thanks! @lwcolton https://github.com/lwcolton, I know you are probably
super busy, just wanted to see if you would by chance have any insight onto
this? The response from add_static_route isn't setting CORS like the other
endpoints I create (with the CORS middleware). Is there a reason for this
that I'm not thinking about? Probably something obvious. Thanks for your
time sir.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/falconry/falcon/issues/1248#issuecomment-390555234,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABWuLu7xEORqSFyKtrwIpuzlb_BJtt0Zks5t0k12gaJpZM4TuXnE
.

--
Sincerely,

Colton Leekley-Winslow
651-242-9559
[email protected]

Hey Colton! No rush at all but just was curious if you looked into this at all yet? If not no worries, appreciate your time!

Hey I finally got a chance to look into this. What's happening is falcon-cors uses the process_resource middleware method to add CORS headers because it allows over-riding CORS configuration on a per-resource basis. Well when using static routes there is no resource and thus the other middleware methods are called but not process_resource. Tl;dr falcon-cors currently does not work with add_static_route but a fix is definitely possible and I will work to get one implemented ASAP

@lwcolton That makes total sense. Thanks for taking the time to look into this sir, much appreciated. If it's something you can point me in the right direction and I can submit a PR, let me know. If it's easier for you to just do it then totally understand.

Hello guys, what's the progress on this issue? I came across the same problem to serve static files, the CORS headers are not set in the response

+1

@lwcolton Hello sir, I know you are really busy and I totally get it, but this is starting to create an issue for us. Can you just give us an estimate on when you think this will be done? Being able to create JSON files and GET'ing them on the front-end would be really nice. Anyway help with this would be much appreciated.

@dave4jr that's the same issue my team is having. We built a modestlty complex web application using falcon, we need to serve some GeoJSON files to the front-end but our hands are tied. A workaround is to use another server to provide the files, but that's not how it should be, does it? If @lwcolton provides some insights on how to solve the issue, I'd spare some coding hours to work on that. I'm sure that @dave4jr would agree to help too. Thanks in advance, falcon has been great to my team purposes, and I'd be glad to help improving it

I know what needs to happen, the middleware needs to switch from using
process_resource to process_response and the tests need to be updated.
I'll sit down with it right now and see if I cant get this done tonight

On Wed, Aug 22, 2018 at 3:11 PM Daniel Mejía Raigosa <
[email protected]> wrote:

@dave4jr https://github.com/dave4jr that's the same issue my team is
having. We built a modestlty complex web application using falcon, we need
to serve some GeoJSON data to to the front-end but our hands are tied. A
workaround is to use another server to provide the files, but that's not
how it should be, does it? If @lwcolton https://github.com/lwcolton
provides some insights on how to solve the issue, I'd spare some coding
hours to work on that. I'm sure that @dave4jr https://github.com/dave4jr
would agree to help too. Thanks in advance, falcon has been great to my
team purposes, and I'd be glad to help improving it

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/falconry/falcon/issues/1248#issuecomment-415163654,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABWuLo1Zsp2vHLjbxLVPLdmjzHpDsR1vks5uTbsMgaJpZM4TuXnE
.

--
Sincerely,

Colton Leekley-Winslow
651-242-9559
[email protected]

Does someone experiencing this issue want to verify my changes work and
nothing else breaks for them:
https://github.com/lwcolton/falcon-cors/compare/fix-static-route

Otherwise I'm about ready to cut a release of falcon-cors. Thanks everyone

On Wed, Aug 22, 2018 at 3:27 PM Colton Leekley-Winslow lwcolton@gmail.com
wrote:

I know what needs to happen, the middleware needs to switch from using
process_resource to process_response and the tests need to be updated.
I'll sit down with it right now and see if I cant get this done tonight

On Wed, Aug 22, 2018 at 3:11 PM Daniel Mejía Raigosa <
[email protected]> wrote:

@dave4jr https://github.com/dave4jr that's the same issue my team is
having. We built a modestlty complex web application using falcon, we need
to serve some GeoJSON data to to the front-end but our hands are tied. A
workaround is to use another server to provide the files, but that's not
how it should be, does it? If @lwcolton https://github.com/lwcolton
provides some insights on how to solve the issue, I'd spare some coding
hours to work on that. I'm sure that @dave4jr
https://github.com/dave4jr would agree to help too. Thanks in advance,
falcon has been great to my team purposes, and I'd be glad to help
improving it

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/falconry/falcon/issues/1248#issuecomment-415163654,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABWuLo1Zsp2vHLjbxLVPLdmjzHpDsR1vks5uTbsMgaJpZM4TuXnE
.

--
Sincerely,

Colton Leekley-Winslow
651-242-9559
[email protected]

--
Sincerely,

Colton Leekley-Winslow
651-242-9559
[email protected]

@lwcolton thanks so much sir. Looks like it's working for me. If you cut the release soon I can upgrade and try again with the new release.

I can't test it at the moment, but I'm looking forward to the release

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhuitema picture jhuitema  Â·  6Comments

codenoid picture codenoid  Â·  4Comments

mortymacs picture mortymacs  Â·  5Comments

bootrino picture bootrino  Â·  3Comments

neilalbrock picture neilalbrock  Â·  5Comments