Welcome! Log In Create A New Profile

Advanced

Re: Separated reverse proxy for different users

Francis Daly
September 03, 2017 05:18AM
On Sat, Sep 02, 2017 at 03:53:52PM -0400, ivy wrote:

Hi there,

there are a few things here I'm not sure about.

> location / {
> try_files $uri $uri/ =404;

Why is that line there? That probably says "return 404 to most
requests". You report that you get a 404 to most requests. Remove that
line if you cannot say what you think it should be doing.

> auth_basic "restricted content";
> auth_basic_user_file "/home/secure/.passwords";
> auth_request_set $auth_status $upstream_status;
>
> proxy_pass http://127.0.01:$rp_port

If you copy-paste'd that line, you possibly have some typos in your config.

If you transcribed that line, then this is an indication of why you
should not transcribe.

> 2017/09/02 12:46:32 [error] 26959#26959: *1905 connect() failed (111:
> Connection refused) while connecting to upstream, client: client_ip, server:
> ..., request: "POST / HTTP/1.1", upstream: "http://server_ip:10081/", host:

"10081" corresponds to "john", yes? Your proxy_pass line wanted to talk
to 127.0.0.1, but the log line says server_ip.

I suspect that you are not testing with the configuration/logs that you
are showing here.

Anyway: the log line says that the server on 10081 is not running. Is
the server on 10081 running? If not, make it be running before you test again.

> I added URI in the proxy_pass line:
> proxy_pass http://127.0.0.1:$rp_port$uri;

That should not be necessary, if the first problems are solved.

> - However, on request of any sub-location (like: my.site.info/about) the
> proxy_pass generates redirect to itself.

Just for clarity: a 404 is not a redirect to itself.

The 404 probably comes from your try_files line, before proxy_pass takes
effect. Your upstream server on port 10081 probably shows nothing in
its logs for this request.

> Here
> (https://www.jethrocarr.com/2013/11/02/nginx-reverse-proxies-and-dns-resolution/)
> provided number of workarounds with changing upstreams. I tried all of them
> with the same result as above - sub-locations give error 404.

I don't see any suggestions on that page that are relevant to you; you
don't have varying hostnames in your proxy_pass directives, unless I
have missed something.

> I'd glad to try more ideas.

Remove the try_files line; and if something remains imperfect, build a
test system that does not have any secret names or addresses and show
the actual tested configuration, request, and logged result.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Separated reverse proxy for different users

ivy August 25, 2017 06:33AM

Re: Separated reverse proxy for different users

Francis Daly August 30, 2017 02:10PM

Re: Separated reverse proxy for different users

ivy September 02, 2017 03:53PM

Re: Separated reverse proxy for different users

Francis Daly September 03, 2017 05:18AM

Re: Separated reverse proxy for different users

ivy September 15, 2017 01:20PM

Re: Separated reverse proxy for different users

Ish Sookun September 03, 2017 07:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready