Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i forward to a folder? #104

Closed
danmed opened this issue Mar 15, 2019 · 112 comments
Closed

How do i forward to a folder? #104

danmed opened this issue Mar 15, 2019 · 112 comments

Comments

@danmed
Copy link

danmed commented Mar 15, 2019

I'd like to have something like

https://sub.domain.com forward to https://192.168.1.1:8080/sub

is that currently possible? I can't find a way to achieve it.. I've tried searching issues but i think i'm missing some fundamental vocabulary to find my answer..

@jc21
Copy link
Member

jc21 commented Mar 18, 2019

I guess it depends on the upstream service. What is "sub"? Does https://192.168.1.1:8080/ redirect to sub alone? If so, just forward to / and let it do it's thing.

FWIW this project isn't trying to solve these types of problems. It's just trying to expose upstream services, not redirect their paths.

@danmed
Copy link
Author

danmed commented Mar 18, 2019

sub can be anything... so http://jeff.mydomain.com forward to http://192.168.1.1/sonarr

for example..

@jc21
Copy link
Member

jc21 commented Mar 18, 2019

So in that example, http://192.168.1.1/sonarr is another reverse proxy for http://192.168.1.1:8989 so why not just create http://sonarr.mydomain.com -> http://192.168.1.1:8989

@danmed
Copy link
Author

danmed commented Mar 19, 2019

I dont think i'm explaining myself very well..

Say for example i have a system that hosts many things... each of them available in different sub folders..

http://192.168.1.1/sonarr
http://192.168.1.1/randomsite
http://192.168.1.1/cameras

now i'd like, in nginx proxy manager to set up a subdomain for each one of those.

http://sonarr.domain.com
http://randomsite.domain.com
http://cameras.domain.com

i currently can't do this, yet it can be done in the config files that i used to use...

Now, if i'm being a dumbass here, it's because of a lack of vocabulary to fully explain myself..

@kolbii
Copy link
Contributor

kolbii commented Mar 19, 2019

http://192.168.1.1/sonarr what does this mean? Do you already have a running web server that serves the sonar at that URL?

By the way, are you sure this project is that tool what you need?
To serve sonar, camera platform or any other things just set a standalone NGINX up.

@danmed
Copy link
Author

danmed commented Mar 19, 2019 via email

@jc21
Copy link
Member

jc21 commented Mar 19, 2019

I think you're explaining yourself ok, but I don't think you're understanding that you are already running a webserver as a reverse proxy on that windows machine that sits in front of your services. Since this project is just that, you don't need both. Whatever is running on port 80 on 192.168.1.1 is what you need to skip over and connect directly to the service.

FWIW the sonarr instructions for windows do in fact listen on port 8989 on the box you're running it on.

Just try it. Create a proxy hist in NPM that points to the machine running Sonarr on port 8989 and see what happens.

@danmed
Copy link
Author

danmed commented Mar 20, 2019 via email

@ursus69
Copy link

ursus69 commented Apr 30, 2019

Hello,
I am having the same problem here.
I can serve my "Guacamole" installation out from "192.168.1.10:8080/guacamole" with clasic Nginx.
But impossible to join in Nginx Proxy Manager, I have tryed everything,
I just get to the "192.168.1.10:8080" wich is the Tomcat root and not the application root.

will you extend this functionallity in the near future?

@danmed
Copy link
Author

danmed commented Apr 30, 2019 via email

@danmed
Copy link
Author

danmed commented May 3, 2019

Here is an example that may help clarify things.

I am running PHPMyadmin on a MySQL box..

I have set up a proxy host in Nginx Proxy Manager as so :

image

The problem is, that to actually access Phpmyadmin, i have to visit

https://sub.domain.co.uk/phpmyadmin

i want to be able to access it by JUST visiting

https://sub.domain.co.uk

@jc21
Copy link
Member

jc21 commented May 8, 2019

I was able to accomplish your situation with the existing interface. However there is a problem that I'll have to solve before it will work for everyone. Stay tuned.

@jc21 jc21 added the bug label May 8, 2019
@danmed
Copy link
Author

danmed commented May 8, 2019 via email

@danmed
Copy link
Author

danmed commented May 8, 2019

I notice you've pushed a fix.. how would i go about getting hold of that fix?

@jc21
Copy link
Member

jc21 commented May 8, 2019

I'm in the middle of testing it along with a few other fixes. Should be releasing within a day

@jc21 jc21 closed this as completed in 22e8961 May 9, 2019
@jc21
Copy link
Member

jc21 commented May 9, 2019

v2.0.13 is up with the fix. Here's how you would setup:

http://example.com -> http://192.168.0.10/phpmyadmin/
  1. Create a proxy host
  2. On the details tab, enter any ip address and port, it's required for the form but it won't actually be used, so it can be anything
  3. On the Custom Locations tab, create a location with / as the location path and for the Forward Hostname / IP enter 192.168.0.10/phpmyadmin/ making sure you have that trailing slash, it's important.
  4. Save, and test.

@ursus69
Copy link

ursus69 commented May 9, 2019 via email

@jc21
Copy link
Member

jc21 commented May 9, 2019

The latest-armhf tag is deprecated. You should be able to use the latest tag and because of docker manifests, you'll get the image applicable for your Pi, which is probably going to be latest-armv7l

@danmed
Copy link
Author

danmed commented May 10, 2019

Thanks for this.. works great (As long as you read the instructions and add the trailing / ) :)

thanks again

@ursus69
Copy link

ursus69 commented May 10, 2019 via email

@bba-dvhk
Copy link

bba-dvhk commented Jan 18, 2020

Hi.
What when we have some Services in folder but don't on default port:
ie:
panel.dom.local -> https://192.168.1.55:48443 Works fine
webmail.dom.local -> https://192.168.1.55/SOGo/:48443 not working
Nginx_Proxy_Manager_-_Google_Chrome_2020-01-18_16-59-49

Nginx_Proxy_Manager_-_Google_Chrome_2020-01-18_17-06-27

but when i point browser to http://192.168.1.55:48443/SOGo/ it works fine.

Is it possibile to make this working??

@jc21
Copy link
Member

jc21 commented Jan 19, 2020

You're putting the Folder Path in the Hostname/IP section which is not the right place. Furthermore, your non-working upstream https://192.168.1.55/SOGo/:48443 is not a valid URL, it should be https://192.168.1.55:48443/SOGo/.

The Custom Locations tab is for sub-folders of your domains.

@bba-dvhk
Copy link

bba-dvhk commented Jan 19, 2020

As I understand Custom Locations work like:

Broswer -> panel.dom.local -> https://192.168.1.55:48443
Broswer -> panel.dom.local/SOGo -> http//192.168.1.55:48443/SOGo
Broswer -> panel.dom.local/admin -> http://192.168.1.55:8080/admin
Broswer -> panel.dom.local/something -> http://156.1.55.6:80/something

Untitled Diagram (2)

I look to achieve:

Broswer -> panel.dom.local -> https://192.168.1.55:48443
Broswer -> webmail.dom.local -> http//192.168.1.55:48443/SOGo
Broswer -> admin.dom.local -> http://192.168.1.55:8080/admin
Broswer -> something.dom.local-> http://156.1.55.6:80/something

Untitled Diagram (3)

@MartinKuhl
Copy link

I have a similar setup, I would like to achieve the following:
Broswer -> sw.domain.org -> http://192.168.1.55:8000/sw
Broswer -> m1.domain.org -> http://192.168.1.55:8000/m1
Broswer -> m2.domain.org -> http://192.168.1.55:8000/m2

I that possible an If how?

@OptimusGREEN
Copy link

I too would like to achieve this.

@nettoinfo
Copy link

nettoinfo commented Apr 30, 2023 via email

@nettoinfo
Copy link

nettoinfo commented Apr 30, 2023 via email

@nettoinfo
Copy link

nettoinfo commented May 31, 2023 via email

@sahara101
Copy link

Hey nettoinfo

Unfortunately your screenshots for guacamole are no longer valid and I am struggling with it :D

I am getting:

https://ssh.xx.xom/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/

@nettoinfo
Copy link

Hey nettoinfo

Unfortunately your screenshots for guacamole are no longer valid and I am struggling with it :D

I am getting:

https://ssh.xx.xom/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/

Hello.
You can use the example of @souporman or @Tamrac-web. They just used my example and changed it according to their environment.
If I can help, just leave your message here...

@nettoinfo
Copy link

Hey nettoinfo

Unfortunately your screenshots for guacamole are no longer valid and I am struggling with it :D

I am getting:

https://ssh.xx.xom/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/guacamole:8060/

Send here the images of how you are placing...

@Rapture1781
Copy link

Hi!
I have the same issue with ocs inventory...
If I connect to the site via https using the address name the website is loaded but without the CSS... if I digit the ip address instead of the name it works fine...
If I will find a solution I will post it!

@NazgulCoder
Copy link

for all the people who need to do what OP wanted to do, I just figured it out this way it works for me

image

image

@nettoinfo
Copy link

nettoinfo commented Nov 7, 2023 via email

@EvilrootNix
Copy link

Hi! I have the same issue with ocs inventory... If I connect to the site via https using the address name the website is loaded but without the CSS... if I digit the ip address instead of the name it works fine... If I will find a solution I will post it!

Same issue, version 2.10.4

subdomain.domain.com -> IP:port/path and does not show the CSS.

Please, reopen the bug.

@EvilrootNix
Copy link

v2.0.13 is up with the fix. Here's how you would setup:

http://example.com -> http://192.168.0.10/phpmyadmin/
1. Create a proxy host

2. On the details tab, enter any ip address and port, it's required for the form but it won't actually be used, so it can be anything

3. On the Custom Locations tab, create a location with `/` as the location path and for the **Forward Hostname / IP** enter `192.168.0.10/phpmyadmin/` making sure you have that trailing slash, it's important.

4. Save, and test.

Does not work 100%, does not show the CSS.

@continue47
Copy link

This is what worked for my setup:

We have a Proxy Host with domain.com forwarding to 192.168.1.1:8000 (can be any IP/port):

Custom configuration in the "Advanced" tab:

location / {
    proxy_pass http://192.168.1.1:8000/custom_dir/;
}

Visiting domain.com displays the contents of 192.168.1.1:8000/custom_dir/ without redirecting.

@europacafe
Copy link

europacafe commented Feb 2, 2024

Just to confirm adding the below line in Advanced tab works!...thanks
location = /{return 301 $scheme://$http_host/subfolder/;}

@echoparkbaby
Copy link

I'm trying to get to my pihole and have tried these methods but it's not working for me.

Trying to have it load http://10.0.0.253/admin/login.php but it only loads to the 10.0.0.253

I've tried both ways, setting up a Custom Location (resolves to root page) and the Advanced (also resolved to root page - settings pictured here). Am I missing something in my config?

image image

@europacafe
Copy link

europacafe commented Feb 4, 2024

Strange. Your settings are exactly like mine and it just works.
location = /{return 301 $scheme://$http_host/admin/;}
I do not use Customs Location tab.

Did you try clearing cache and browsing history and try again;or too ensure the new settings kicks in, browse in incognito mode.
image

image

@echoparkbaby
Copy link

I tried clearing and using incognito. I should not that I'm trying to access local services using Local DNS on pihole, that routes over to NPM. Other services are working like pve1.local to my promox server, just can't get this one with a folder in it's url to work.

@continue47
Copy link

For pihole I'm doing redirect from / to /admin/ with:

location = / {
    return 301 /admin/;
}

@echoparkbaby
Copy link

thanks. tried that, but it just takes me to the "placeholder page" :(

@SgtErnestBilko
Copy link

SgtErnestBilko commented Feb 12, 2024

I am having the exact same issue with pihole. I have tried both all of the custom configs mentioned above as well as EvilrootNix's fix.

@europacafe
Copy link

both what @echoparkbaby and @continue47 suggested work for me. Strange they are not working for some installation.

@SgtErnestBilko
Copy link

SgtErnestBilko commented Feb 12, 2024

I know it is very strange. I have been thinking this afternoon and was going to suggest it might be an underlying OS issue , but of course it can't be as we are all running a docker image from https://nginxproxymanager.com/ aren't we ?

Maybe it is a docker or npm version issue. I'm running docker 25.0.1 and npm 2.11.1

I'm no expert when it comes to NGINX conf files but does this look right (below) to anyone who knows (i.e. 2 x location. one with = sign and one without ?

location = /{return 301 $scheme://$http_host/admin/;} 


  location / {



    # Proxy!
    include conf.d/include/proxy.conf;
  }

@europacafe
Copy link

europacafe commented Feb 12, 2024

I run NPM 2.11.1 as a docker container on Unraid which runs docker engine 20.10.24.
I run NPM container by using br0 bridge (MacVLAN network), with a fixed ip of my main LAN subnet (192.168.2.x). My Pihole is running natively on a Debian VM on Unraid, thus Pihole got a fixed ip of my main LAN subnet too.

Server: Docker Engine - Community

Engine:
 Version:          20.10.24
 API version:      1.41 (minimum version 1.12)
 Go version:       go1.19.7
 Git commit:       5d6db84
 Built:            Tue Apr  4 18:23:02 2023
 OS/Arch:          linux/amd64
 Experimental:     false
containerd:
 Version:          v1.6.20
 GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38
runc:
 Version:          1.1.5
 GitCommit:        v1.1.5-0-gf19387a6
docker-init:
 Version:          0.19.0
 GitCommit:        de40ad0

Why do you include conf.d .... in your NPM Advanced tab?

@SgtErnestBilko
Copy link

"Why do you include conf.d .... in your NPM Advanced tab?"

I don't..... I logged on to the docker shell to see what the conf file looked like.

@SgtErnestBilko
Copy link

OK.....solved. For me it was a dns issue, my subdomain names were not being resolved.

I took the plunge and replaced pihole with Bind9. There is a good tutorial on Y_tube ... search for "You want a real DNS Server at home? (bind9 + docker)". I'm not saying it was pihole's fault (I was using it as a DNS server) but a clean install of a dns server worked for me.

@MetriXmsk
Copy link

This is what worked for my setup:

We have a Proxy Host with domain.com forwarding to 192.168.1.1:8000 (can be any IP/port):

Custom configuration in the "Advanced" tab:

location / {
    proxy_pass http://192.168.1.1:8000/custom_dir/;
}

Visiting domain.com displays the contents of 192.168.1.1:8000/custom_dir/ without redirecting.

Works great for me. Thanks!

@DarkTearStudios
Copy link

DarkTearStudios commented Feb 16, 2024

Had the exact same issue with pihole, not redirecting to /admin no matter what I put in advanced. the fix was quite simple and hit me like a slap in the face lol.

On my pihole (using as a dns server) I had the dns point to the pihole ip, not the nginx ip. fixed that now alls good.

@Felitendo
Copy link

Thank you, @nettoinfo your suggestion of adding location = /{return 301 $scheme://$http_host/folder/;} to "Advanced" was exactly what I needed. Now my guacamole and uptime kuma are working just like I want. Using Uptime Kuma as an example (@VictorVonFrankenstein looked like that's what he was trying to figure out), it looks like this:

image Where 192.168.1.231 is the server hosting Kuma, and port 3001 is the standard port for that image If you look at this picture you will see that the only thing I modified from @nettoinfo's original advice was to replace "folder" with my desired subfolder. In this case, it was to see an Uptime Kuma status page, whose address would otherwise be: http://192.168.1.231:3001/status/all but now I can hit it by typing http://uptime.domain.name

You are a legend!

@nettoinfo
Copy link

nettoinfo commented Mar 16, 2024 via email

@erdnuesse
Copy link

Anyone has the specific setting that fixed CSS for them? Redir to folder works, but the CSS issue bugs me.
My setup has a searxng instance in its default path - bc/ I prefer default paths and settings for everything, makes redeployments easier, but considering the change to / just because NPM doesn't like it at all. : /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests