I am running a small django app with django admin.
In fact, I only use django admin to edit a few models.
It works fine in local and behind a simple proxy reverse, but now I have this kind a rewrite that changes the path: (it's a nginx ingress rewrite rule for Kubernetes)
path: /diagnosis-admin(/|$)(.*) => $2
-
Request URL:
-
Request Method:
GET
-
Status Code:
301
-
Remote Address:
-
Referrer Policy:
strict-origin-when-cross-origin
-
Response Headers
-
content-length:
0
-
content-type:
text/html; charset=utf-8
-
date:
Tue, 19 Oct 2021 15:11:42 GMT
-
location:
/admin/
-
script_name:
/diagnosis-admin
-
strict-transport-security:
max-age=15724800; includeSubDomains
-
x-content-type-options:
nosniff
I had this problems with other applicative frameworks but could solve it since they can interpret the FORWARDED_HOST, FORWARDED_PORT and FORWARDED_PATH headers provided by the proxy.
Searching the internets gave me tons of solutions for reverse proxy with simple rewrite rules with no path alterations, but here I am stuck
I have no idea how to solve this withing django. Any help will be much appreciated
Additionnal information:
I run django with "python manage.py runserver 0.0.0.0:8000" on a docker container (running through GKE)
Everything is pretty standard, I ran the basic django project scafolding, setup the database, auto migrated the models and that's about it. I can provide additionnal files if needed