Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to tell Flask to ignore a path?

Currently my Flask is serving from root path like http://example.com/ so it basically serves every request incoming to it. But I have the necessity to serve http://example.com/start from Apache and not trough Flask.

So I'd like to know if there is any way to tell Flask to ignore @app.route("/start") or to tell Flask to let apache override the path serving.

I'm using a shared host server so I don't have access to apache configuration files.

Thanks in advance, if there is any information needed feel free to ask.

like image 436
Aitor Martin Gonzalez Avatar asked Dec 04 '25 17:12

Aitor Martin Gonzalez


1 Answers

By the time Flask is handling a request, the web server has already passed the request to the application and is awaiting a response. At that point, there's no protocol for Flask to "cancel" handling the request. You'll need to modify Apache's configuration to only pass requests which do not match your path to the Flask application. If you're on a shared host, you might still be able to modify an .htaccess file to set up the forwarding rules.

like image 73
David Sanders Avatar answered Dec 06 '25 12:12

David Sanders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!