Skip to content

Instantly share code, notes, and snippets.

@taufiqpsumarna
Created August 13, 2024 05:11
Show Gist options
  • Save taufiqpsumarna/4a617acbf1699fe5f3e77f12e0ef0951 to your computer and use it in GitHub Desktop.
Save taufiqpsumarna/4a617acbf1699fe5f3e77f12e0ef0951 to your computer and use it in GitHub Desktop.
nginx reverse proxy for prometheus HTTP Basic Auth
server {
listen 80;
server_name <YOUR_DOMAIN_NAME>;
auth_basic "prometheus auth";
auth_basic_user_file /etc/nginx/.htpasswd_prometheus;
location / {
proxy_read_timeout 1800s;
proxy_connect_timeout 1600s;
proxy_pass http://localhost:9090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_redirect off;
}
location /ready {
proxy_pass http://localhost:9090;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_redirect off;
auth_basic "off";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment