Skip to content

Commit 913a084

Browse files
adding exceptions for common monitoring endpoints
1 parent 4e258ca commit 913a084

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker image of Nginx Proxy with Basic Auth
22

3-
[![Docker Repository on Quay](https://quay.io/repository/dtan4/nginx-basic-auth-proxy/status "Docker Repository on Quay")](https://quay.io/repository/dtan4/nginx-basic-auth-proxy)
3+
[![Docker Repository on Quay](https://quay.io/repository/thomasjungblut/nginx-basic-auth-proxy/status "Docker Repository on Quay")](https://quay.io/repository/thomasjungblut/nginx-basic-auth-proxy)
44

55
Simple HTTP Proxy with Basic Authentication
66

@@ -10,6 +10,9 @@ User ---------------> | nginx-basic-auth-proxy | ---> | HTTP Server |
1010
+------------------------+ +-------------+
1111
```
1212

13+
This project is a fork of [dtan4's nginx basic auth proxy](https://github.com/dtan4/nginx-basic-auth-proxy).
14+
I only added a couple of common monitoring endpoints (/healthz, /ping, /status, /metrics and /version) to be accessible without basic auth.
15+
1316
## Run
1417

1518
```bash
@@ -23,7 +26,7 @@ $ docker run \
2326
-e PROXY_PASS=https://www.google.com \
2427
-e SERVER_NAME=proxy.dtan4.net \
2528
-e PORT=80 \
26-
quay.io/dtan4/nginx-basic-auth-proxy
29+
quay.io/thomasjungblut/nginx-basic-auth-proxy
2730
```
2831

2932
Access to http://localhost:8080 , then browser asks you username and password.
@@ -70,7 +73,7 @@ Reading: 0 Writing: 1 Waiting: 0
7073
|`PROXY_READ_TIMEOUT`|Value for `proxy_read_timeout` directive|`60s`|
7174
|`WORKER_PROCESSES`|Value for `worker_processes` directive|`auto`|
7275

73-
## Author
76+
## Original Author
7477

7578
Daisuke Fujita ([@dtan4](https://github.com/dtan4))
7679

files/nginx.conf.tmpl

+22
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ http {
2828
proxy_set_header X-Forwarded-Host $host;
2929
# Do not pass Authorization header to destination
3030
proxy_set_header Authorization "";
31+
}
32+
33+
# we turn a couple of common locations off harcoded
34+
35+
location /healthz {
36+
auth_basic off;
37+
}
38+
39+
location /ping {
40+
auth_basic off;
41+
}
42+
43+
location /metrics {
44+
auth_basic off;
45+
}
46+
47+
location /status {
48+
auth_basic off;
49+
}
50+
51+
location /version {
52+
auth_basic off;
3153
}
3254
}
3355

0 commit comments

Comments
 (0)