301 executes before authentication

B.R. reallfqq-nginx at yahoo.fr
Tue Oct 6 14:15:54 UTC 2015


In the links provided above, I see one example of Maxim suggesting a
2-steps solution playing with a returned status code.
---
*B. R.*

On Tue, Oct 6, 2015 at 3:15 PM, Grant <emailgrant at gmail.com> wrote:

> > Rewrites will execute before authentication module handlers run; this is
> a
> > function of how Nginx is designed, and this order isn't configurable. See
> > http://forum.nginx.org/read.php?2,41891,43112#msg-43112 and
> > http://www.nginxguts.com/2011/01/phases/.
>
>
> In that case, can anyone figure out how to rewrite this config without
> a redirect so that munin can be accessed with host:port?  I worked on
> it for quite a bit but couldn't come up with anything functional.
>
> location = / {
>     return 301 https://$host:$server_port/munin/;
> }
>
> location /munin {
>     fastcgi_split_path_info ^(/munin)(.*);
>     fastcgi_param PATH_INFO $fastcgi_path_info;
>     fastcgi_pass unix:/var/run/munin/fcgi-html.sock-1;
>     include fastcgi_params;
> }
>
> - Grant
>
>
> >>> I have a server block that contains the following:
> >>>
> >>> auth_basic "Please log in.";
> >>> location = / {
> >>>     return 301 https://$host:$server_port/folder/;
> >>> }
> >>>
> >>> I noticed that /folder/ is appended to the URL before the user is
> >>> prompted for authentication.  Can that behavior be changed?
> >>>
> >>> - Grant
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151006/e132ebec/attachment.html>


More information about the nginx mailing list