Skip to content

Commit

Permalink
Add example of mapping usernames to in the htadmin nginx example
Browse files Browse the repository at this point in the history
  • Loading branch information
elonen committed Jun 11, 2024
1 parent 7f65815 commit 2c24b62
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/debian/additional_files/clapshot+htadmin.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#
# Copy this to /etc/nginx/sites-available/clapshot and customize.

# Assign admin rights to some usernames
map $remote_user $is_admin {
default 0;
admin 1;
#alice 1;
}

server {

listen 80 default_server;
Expand All @@ -22,7 +29,7 @@ server {
auth_basic_user_file /var/www/.htpasswd;
proxy_set_header X-Remote-User-Id $remote_user;
proxy_set_header X-Remote-User-Name $remote_user;

proxy_set_header X-Remote-User-Is-Admin $is_admin;

location /videos {
alias /mnt/clapshot-data/data/videos;
Expand All @@ -43,6 +50,7 @@ server {
# Pass authenticated username to backend
proxy_set_header X-Remote-User-Id $remote_user;
proxy_set_header X-Remote-User-Name $remote_user;
proxy_set_header X-Remote-User-Is-Admin $is_admin;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down

0 comments on commit 2c24b62

Please sign in to comment.