NGINX proxy_pass with changing URI

us flag

What I want to achieve:

When I access my site "", it will point to page which is the comic webserver login page. I will enter my password, the comic web server will then to 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    ;
     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 it points to the login page which is, then after that it proceeds according the URI as set by the web server.

The comic webserver has pages like:

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.

us flag

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.

djdomi avatar
za flag
remember that you need to accept your own answer

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.