I'm creating a service in which django containers are spawned on demand for users to test backend-functionality online.
I would like to make the spawned instances available to users on main domain:
Example: User spawns container userapp
which exposes port 8000
, it should be accessible on my domain as mydomain.net/userapp/
I do not know the amount of instances running, or their names in advance.
I found a nginx-proxy container here which dynamically creates configs for nginx to serve containers to subdomains:
$ docker run -e VIRTUAL_HOST=userapp.mydomain.com ...
I would like to have it accessible on the path. How can I create dynamic proxy paths with nginx or django?
I figured this out with django-http-proxy.
I can inherit from
HttpProxy
and create aDynProxyView
:views.py
urls.py
models.py
This way I can get the desired effect.