Welcome! Log In Create A New Profile

Advanced

Re: Nginx Can't get the request port when doing proxy

Maxim Dounin
November 24, 2011 05:28AM
Hello!

On Thu, Nov 24, 2011 at 05:16:04AM -0500, higkoo wrote:

> such as :
> Client(192.168.1.101) want visit http://192.168.1.201:9000/myfile
> example,and need visit other ports.
> but client must use proxy to visit. Nginx is the proxyer!
>
> Nginx proxy running on 192.168.1.202 and listen at port 8080 .
> I use '''proxy_pass $scheme://$host$request_uri;''' to make
> proxy,but I get http-502 when I use this proxy-server.
> Becase nginx use the default port 80 to proxy:
> | request = http://192.168.1.201:9000/myfile
> | proxy-server = 192.168.1.202 8080
> | proxy-to = http://192.168.1.201:80/myfile
> There are only $remote_port and $server_port on nginx-variables:
> http://wiki.nginx.org/HttpCoreModule#Variables
>
> If I just want visit port 9000 on 192.168.1.201,I can write by
> '''proxy_pass $scheme://$host:9000$request_uri;'''
> But it's not a good idea ,and there are some other port to use.
>
> How can I do ?

Just a side note:

nginx isn't forward proxy, it's reverse proxy. By using nginx as
a forward proxy you are looking for problems, including security
ones.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx Can't get the request port when doing proxy

higkoo November 24, 2011 05:16AM

Re: Nginx Can't get the request port when doing proxy

Maxim Dounin November 24, 2011 05:28AM

Re: Nginx Can't get the request port when doing proxy

higkoo November 25, 2011 12:53AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready