Welcome! Log In Create A New Profile

Advanced

Re: Redirect to external site

Vladimir Homutov
October 02, 2018 08:42AM
On Mon, Oct 01, 2018 at 12:22:59PM -0700, Brian W. wrote:
> I have gotten the ldap setup working with their backend-sample-app.py file
> properly and it displays the hello world message. What I cannot figure out
> is how to redirect it to another url on another machine, as opposed to that
> local page, if auth works. Most of the attempts I have tried lead to a
> blank white page sadly. I tried a simple requests or urllibrequest, as well
> as a selfsend_header with the new url. Has anyone else gotten this to work?
>
> Brian

What happens after you succesfully authenticated user, is controlled by
location where your 'auth_request' directive is written.

In example config, it contains:

location / {
auth_request /auth-proxy;

error_page 401 =200 /login;

proxy_pass http://backend/;
}

i.e. users request is passed to an upstream (backend-sample-app.py application).

If you want instead of proxying, return some redirect (and probably set some
headers with data obtained from authentication), you have to setup nginx
to do it, using appropriate directives.

Please refer to:

http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
http://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Redirect to external site

Brian W. October 01, 2018 03:26PM

Re: Redirect to external site

Vladimir Homutov October 02, 2018 08:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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