Rerouting request via middleware in django
I ended up doing a rewrite in nginx (using proxy_pass).
I couldn't solve this at the application level in any feasible way.
I have a java server sending out a request where the path contains the hostname.
OTOH I've got an ancient django server (1.8) that figures (wrongly) that the hostname is part of the path, and always returns a 404.
Assuming that sending properly formed requests from java side is not possible, how would I go about modifying the request URL to something that can be properly redirected to, without actually redirecting? (a 30x is also unacceptable in this case).