Why non existing URL containing the sharp ("#") sign in Python/Flask aren't handled by the errorhandler Why non existing URL containing the sharp ("#") sign in Python/Flask aren't handled by the errorhandler flask flask

Why non existing URL containing the sharp ("#") sign in Python/Flask aren't handled by the errorhandler


Everything after the # forms the fragment identifier of a resource and is handled client side. In the normal course of operation, the fragment identifier is never sent to the server:

The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the web server

If a server is ever sent a fragment identifier in a URL, it must ignore this part of the URL. It is not part of the path, and thus Flask just sees 127.0.0.1:7777/ for all your sample URLs with a fragment.