I'm currently running a docker-compose application with an nginx in front, accessing 3 separate docker applications (flask api, angular, jupyter notebook).
I have it currently working where localhost/api, localhost/dev, and localhost/jupyter is set up and functional.
What I'm trying to do that I'm having issues with, is doing proxy pass redirecting without changing the angular and jupyter applications. To make things functional, I had to, for example, add c.NotebookApp.base_url = '/jupyter'
to jupyter image and change <base href="/dev/">
in the angular image html, and I would prefer not doing that.
Is there a way for nginx to automatically proxy all the connection information so I don't have to change the original applications?
My current attempts to redirect Jupyter notebook results in the client looking from localhost/jupyter
the html/css files at localhost/[something].js
, so errors occur because the correct files are located at localhost/jupyter/[something].js
.
Here is my current nginx.conf that is working.
nginx.conf
http {
include /etc/nginx/mime.types;
server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
## may need mal-json/ for final
server_name localhost;
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
}
location /api/ {
proxy_pass http://api:8000/;
}
location /dev/ {
proxy_pass http://angular:4200/;
}
location /jupyter/ {
proxy_pass http://jupyter:8888;
}
location ^~ /sockjs-node/ {
proxy_pass http://angular:4200;
}
}
Please let me know if I am missing any information. I mainly want to know if what I am doing is possible. I realize that nginx can redirect the main requests to the correct url, but I am having trouble with the following requests, such as the css/js that comes from the connection.