0

What I want to achieve:

When I access my site "https://my.domain.com/comics", it will point to http://192.168.1.55:3322/login page which is the comic webserver login page. I will enter my password, the comic web server will then to http://192.168.1.55:3322/dashboard. After which I can navigate to books, accounts, etc pages of said webserver.

The only way I can get this to work if my settings were like this:

 location / {
     proxy_pass              http://192.168.1.55:3322/;
     proxy_set_header        X-Forwarded-Host        $server_name:$server_port;
     proxy_hide_header       Referer;
     proxy_hide_header       Origin;
     proxy_set_header        Referer                 '';
     proxy_set_header        Origin                  '';
     add_header              X-Frame-Options         "SAMEORIGIN";

With these settings, everything works fine. The pages get directed as intended. I understand that it works because location / matches with everything.

So, what I want to do is that when I type https://my.domain.com/comics it points to the login page which is http://192.168.1.55:3322/login, then after that it proceeds according the URI as set by the web server.

The comic webserver has pages like:

http://192.168.1.55:3322/login
http://192.168.1.55:3322/dashboard
http://192.168.1.55:3322/account
http://192.168.1.55:3322/books

I am quite new at nginx and willing to learn. I tried reading the manual pages, but have difficulty visualizing how certain parameters work. The parameters I wrote above was from another page that teaches how to set up nginx with a torrent server.

Thank you in advance.

Fish Puki
  • 1
  • 1

1 Answers1

0

After posting this, I figured I'll check out the comic media server (Komga), and it actually has a configuration to make the server start a subfolder.

SERVER_SERVLET_CONTEXT_PATH / server.servlet.context-path: <baseUrl>

Base URL, useful if you need to reverse proxy with a subfolder.

Defaults to /

I managed to add that configuration and now everything works as intended.

Fish Puki
  • 1
  • 1