Jump to content

Question about reverse proxy


aahmyu

Recommended Posts

aahmyu

Hello, Thanks to thee guides here i managed to setup a reverse proxy server using nginx for my servers.

 

I have a couple of questions though:

 

1-  When i access emby.mydomain.com locally does the request go through the internet? i did a ping test and when pinging my domain locally i getting the same ping as i ping emby local address. But im a bit noob when it comes to this so im just double checking here.

 

2-  This is why im actually posting here. when i access emby from my domain locally the logs display my external ip address which is not wrong because my domain resolves to my external ip, my question is, is it possible to get the client real ip address like 192.168.1.55 when i access locally instead of my external ip?

 

Thanks

Link to comment
Share on other sites

I would check the server activity viewer in the server dashboard, where it shows the ip address. What does it say there?

Link to comment
Share on other sites

aahmyu

When I'm at home it displays the router external ip no matter what device I use. And remotely it displays the ip I'm connecting from.

 

Maybe what I'm asking is not possible?

I'm trying to find a way to display the correct internal ip when I'm at home instead of displaying router external ip all the time

Link to comment
Share on other sites

darkassassin07

The way I achieved this was by setting the host name of the device my nginx server is running on to be the same as my domain name.

 

In my routers configuration, devices that have been given a dhcp reservation (for a static ip address) also have the option to specify a hostname. Seprate from that there is also a box for custom dnsmasq parameters that I have hostname/ip address combinations in.

 

 

Because of this, devices that try my domain name while on lan are given the lan ip of the nginx server instead of my wan ip.

 

Im sure there are other ways as well, but im a bit of a noob myself :)

 

Hope that helps a bit

 

/edit for this method to work you have to be using the same port for lan/wan access.

Example:

Mydomain.com:443 on wan

[nginx lan ip]:443 on lan

These two port numbers should match regardless of which port you chose

Edited by darkassassin07
Link to comment
Share on other sites

pir8radio

Hello, Thanks to thee guides here i managed to setup a reverse proxy server using nginx for my servers.

 

I have a couple of questions though:

 

1-  When i access emby.mydomain.com locally does the request go through the internet? i did a ping test and when pinging my domain locally i getting the same ping as i ping emby local address. But im a bit noob when it comes to this so im just double checking here.

 

2-  This is why im actually posting here. when i access emby from my domain locally the logs display my external ip address which is not wrong because my domain resolves to my external ip, my question is, is it possible to get the client real ip address like 192.168.1.55 when i access locally instead of my external ip?

 

Thanks

 

 

Yea you shouldn't use the domain name from within your house, what it does is looks up the domain name on the net, gets the wan ip, and ends up using a "loopback interface" within your router.  I mean it will work but its not ideal..   I would just use the server computer name similar to what dark assassin said above.  

Edited by pir8radio
Link to comment
Share on other sites

aahmyu

Thanks for your replies. I will take a look again today. The thing is my router is basic provider router and doesn't have advanced options.

Link to comment
Share on other sites

darkassassin07

If you cant do it through the router itself, you should also have the option on most operating systems to set a hostname for that device.

Just google 'set [os name] hostname'. ('set windows 10 hostname' for example).

You will most likely have to restart the network connection on that device after changes are made (re-plugin the lan cable, or re-connect to the wifi, or just restart the whole device)

 

I don't have much experience with that myself, so sry I can't be more help.

 

Once you have your hostname set, you can use the dev tools in chrome to see what ip address your given when you try to connect to your domain name.

If all is setup correctly, devices outside your lan should be given your wan ip address by your dns provider and devices on your lan should get the lan ip of your nginx server directly from your router.

Edited by darkassassin07
Link to comment
Share on other sites

aahmyu

Thanks for your reply. I found a solution and fixed my issue.

 

I fixed it by running a local dns server on my server and set my router to assign my dns server address instead of my provider's address, also set nginx resolver to my dns server address.

 

Now everything works fine and i can see the correct ip address in emby dashboard.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...