question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Routes added to add_sink override static routes added with add_static_route

See original GitHub issue

Hi Falcon team,

Thanks for all your hard work. I ran into an issue today when I tried to make use of the add_static_route method.

Our project uses add_sink to implement a custom handler for requests with no corresponding handler. However, that add_sink function would gobble up any requests that we intended to be handled by the static route:

api.add_static_route('/static', valid_static_file_path) # Would never get called
api.add_sink(unmatched_route_handler) # Would always swallow calls to assets at `/static/WHATEVER`

The case was the same whether the static route was added before or after the sink.

I would expect that if a static route is added, that resource path is excluded for any sink handlers.

My workaround for now was to basically use a regex on the sink to exclude the static path:

api.add_sink(unmatched_route_auth_wrapper, '^((?!static).)*$')

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
CaselITcommented, Aug 29, 2020

I’ve added a pr #1769 to invert the precedence of the sinks and static routes via a configuration parameter of the app.

By default the behavior is the same as the current one, so no breaking change was added

0reactions
CaselITcommented, Aug 8, 2020

I think how the App interacts with the sinks and static files could be unified to have a single for loop, the two arrays can be simply chained one way or the other according to the setting (this could also be done statically, each time a sink/static file route is added).

https://github.com/falconry/falcon/blob/d946b4f0acf6c9fd25015f517499880c19533932/falcon/app.py#L845-L859

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do track routes override static routes? - Cisco Community
Solved: I ran into a weird issue today I'm trying to figure out. I recently added some SLA monitors and tracks for routes...
Read more >
How to Add or Remove Static Route on Windows - Action1
We will use the so-called 'Root' — meaning we will prescribe routes using the 'route add' command in the Windows command line. Let's...
Read more >
Chapter 20. Configuring static routes Red Hat Enterprise Linux 8
routes sub-command, nmcli overrides all current settings of this parameter. To add a route:.
Read more >
How to Permanently add Static Route in Linux - LinuxOPsys
Here learn how to add permanent static routes in Linux distributions such as CentOS Stream and Ubuntu. Here routes needs be added to...
Read more >
How to add a static route using a PowerShell cmdlet
We show you how to add static routes and its associated parameters to a routing table in Windows using PowerShell cmdlets.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found