Redirect to external site

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirect to external site

Brian W.
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

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Redirect to external site

Vladimir Homutov
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx