Welcome! Log In Create A New Profile

Advanced

Client ip adress gets lost (nginx authentication via sub-request)

July 17, 2019 07:33AM
Hi!

I am using http-auth-request-module on a nginx proxy to authenticate against another server. This other server's authentication mechanism evaluates the requesting client ip adress for authentication purposes.

However, this server only receives the ip adress from the proxy server - regardless from which client i access the proxied URL.

How can i pass the origin client ip adress via the proxy server on to the "authentication server"?

Workflow illustration: https://i.stack.imgur.com/4wNSd.png


...
server {
listen *:80;

location /restricted {
auth_request /auth;
proxy_pass http://proxied-server/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /auth {
internal;
proxy_pass http://authentication-server/;
}
}
...
Subject Author Posted

Client ip adress gets lost (nginx authentication via sub-request)

jko98 July 17, 2019 07:33AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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