ngx_coolkit is collection of small and useful nginx add-ons.
Override HTTP method.
default: none
Decoded password from "Authorization" header (Basic HTTP Authentication).
Name of the matched location block.
http { server { location / { override_method $arg_method; proxy_pass http://127.0.0.1:8100; } } }
Pass request with changed HTTP method (based on "?method=XXX") to the backend.
http { upstream database { postgres_server 127.0.0.1 dbname=test user=monty password=some_pass; }
server {
location = /auth {
internal;
set_quote_sql_str $user $remote_user;
set_quote_sql_str $pass $remote_passwd;
postgres_pass database;
postgres_query "SELECT login FROM users WHERE login=$user AND pass=$pass";
postgres_rewrite no_rows 403;
postgres_output none;
}
location / {
auth_request /auth;
root /files;
}
}
}
Restrict access to local files by authenticating against SQL database.
Required modules (other than ngx_coolkit):