Welcome! Log In Create A New Profile

Advanced

Re: URL-Rewriting not working

Francis Daly
April 09, 2017 11:18AM
On Sun, Apr 09, 2017 at 06:36:51PM +0530, Ajay Garg wrote:

Hi there,

> Got it Francis !!

Good news.

> location / {
> auth_basic 'Restricted';
> auth_basic_user_file
> /home/20da689b45c84f2b80bc84d651ed573f/.htpasswd;
>
> if ($remote_user =
> "20da689b45c84f2b80bc84d651ed573f") {
> proxy_pass
> https://127.0.0.1:2000;
> }
>
> }

When you come to add the second user, you will see that you want one
file with all the user/pass details.

You will probably also see that it will be good to use a map
(http://nginx.org/r/map) to set a variable for the port to connect to,
based on $remote_user. Then your main config becomes just "proxy_pass
http://127.0.0.1:$per_user_port;".

Note that I have not tested that, and expect that there may be some more
subtleties involved, such as perhaps requiring an explicit proxy_redirect
directive.

Note also that you will probably want to set a default value for
$per_user_port, and make sure that something sensible happens when that
value is used -- probably a response along the lines of "something isn't
fully set up on the server yet; please wait or let us know", so the user
is not confused.

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

URL-Rewriting not working

Ajay Garg April 08, 2017 09:12AM

Re: URL-Rewriting not working

Anoop Alias April 08, 2017 09:20AM

Re: URL-Rewriting not working

Ajay Garg April 08, 2017 09:26AM

Re: URL-Rewriting not working

Anoop Alias April 08, 2017 09:42AM

Re: URL-Rewriting not working

Ajay Garg April 08, 2017 09:46AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 06:50AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 07:58AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 08:30AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 08:48AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 09:08AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 11:18AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 11:38AM

Re: URL-Rewriting not working

Lucas Rolff April 09, 2017 11:48AM

Re: URL-Rewriting not working

Ajay Garg April 10, 2017 12:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
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