Auth module question
October 23, 2019 07:30PM
I am very close setting up my auth module. Here is the config. My issue is I cannot pass $query to an external site without using resolver and if I do that then I cannot get redirected after authentication, I receive a 404. Can someone help?

server {
listen 8080 ssl;
ssl_certificate cert.pem;
ssl_certificate_key key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
auth_request /auth;

auth_request_set $auth_status $upstream_status;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Authorization "Basic *****************"; # base64-encoded username:password to pass in header
proxy_pass; L

location = /auth {
# proxy_ssl_verify off;
set $query '';
if ($request_uri ~* "[^\?]+\?(.*)$") {
set $query $1;
proxy_pass https://externalwebsite/auth.php?$query;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
# proxy_set_header X-Original-URI $request_uri;

error_page 401 = @error401;

# If the user is not logged in, redirect them to Vouch's login URL
location @error401 {
return 302;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready