Fake Basic Auth

Christian Felsing pug+nginx at felsing.net
Mon Aug 26 18:19:49 UTC 2013

Sorry, does not what I need:

	proxy_pass  http://myapache:8000;
        rewrite_by_lua '
                ngx.var.remote_user = "user"
                ngx.var.remote_password = "secret"

This should fake a 401 login but I get

2013/08/26 20:11:11 [error] 19175#0: *2 lua entry thread aborted:
runtime error: [string "rewrite_by_lua"]:2: variable "remote_user" not
stack traceback:
coroutine 0:
	[C]: ?
	[string "rewrite_by_lua"]:2: in function <[string "rewrite_by_lua"]:1>,
client:, server: localhost, request: "GET /x.php
HTTP/1.1", host: "test.example.net"

Obviously Nginx does not like any changes on remote_user

in Apache
AuthBasicFake %{SSL_CLIENT_S_DN_CN} %{sha1:passphrase-%{SSL_CLIENT_S_DN_CN}}
set remote_user to value passwd by SSL_CLIENT_S_DN_CN and a fake
password generated from SSL_CLIENT_S_DN_CN

I need something similar for nginx.


Am 25.08.2013 09:20, schrieb smallfish:
> use ngx_lua for 401 auth
> example: http://chenxiaoyu.org/2012/02/08/nginx-lua-401-auth.html 

More information about the nginx mailing list