hexparrot/mineos-node

How can I make MineOS run behind my Nginx reverse proxy with a subpath ?

LeVraiRoiDHyrule opened this issue · 2 comments

Hi,

I already have an Nginx reverse proxy server, that I use for my personal site, Organizr, Jellyfin, Sonarr, Radarr, Webmin, Transmission....
I would like to add MineOS to those services. But I would like to ask for help to do this, as MineOS doesn't provide any nginx config file (most server apps with webui do).

All my other apps require that I set a subpath in the app' settings. Here, I would like to tell MineOS to have a /mineos subpath. But I didn't find how to do that.

Then, I would be able to set a proxy pass in my Nginx config.

My current (not working) setting is the following:

location /mineos/ {
           proxy_pass http://localhost:8443;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
           proxy_http_version 1.1;
           proxy_no_cache $cookie_session;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection $http_connection;
  		proxy_set_header  Connection "Upgrade";
  		proxy_set_header  Host $host;
   }

Could someone help me to do that ?
Any answer is welcome, have a great day

MineOS does not use nginx, it uses Node.js to serve its contents. There is no easy way to config a subpath.
Look at https://serverfault.com/a/725433 for a possible solution.

This would not work.
What happens here is that nginx will redirect to MineOS without a any problems, but MineOS doesn't have support for the subpath, so it will redirect to the root of the URL.

This look like that:

flowchart
    fetch1[http://myserver.com/mineos/ ] -- nginx proxy pass -->
    fetch2[http://10.0.0.45:8080] -- node.js redirect -->
    fetch3[http://myserver.com/admin/index.html] -- nginx error-->
    error1[ERR_HTTP2_PROTOCOL_ERROR]
Loading

What we want:

flowchart
    fetch1[http://myserver.com/mineos/ ] -- nginx proxy pass -->
    fetch2[http://10.0.0.45:8080/mineos/ ] -- node.js redirect -->
    fetch3[http://myserver.com/mineos/admin/index.html] -- nginx proxy pass -->
    fetch4[http://10.0.0.45:8080/mineos/admin/index.html]
Loading

So we have to implement it, this article seems interesting to know how: https://betterprogramming.pub/serving-a-node-js-express-app-from-a-subfolder-a-routing-lifehack-a3c88da9840c