-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix and example for the AUTH_METHOD=PROXY_HEADER
- deny unauthenticated user, in case the proxy has been skipped - mini example with Caddy as proxy adding pseudo authenticated headers
- Loading branch information
1 parent
6c9ec31
commit 7203ae0
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
http_port 8081 | ||
auto_https off | ||
log { | ||
format console | ||
} | ||
servers { | ||
log_credentials | ||
} | ||
} | ||
:8081 { | ||
reverse_proxy otterwiki:80 { | ||
header_up x-otterwiki-name "Otter Example" | ||
header_up x-otterwiki-email "[email protected]" | ||
header_up x-otterwiki-permissions "READ,WRITE,UPLOAD,ADMIN" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
run: | ||
docker compose up --remove-orphans | ||
|
||
caddy-fmt | ||
docker run -v $(PWD)/Caddyfile:/srv/Caddyfile:rw caddy:2 caddy fmt --overwrite Caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Example for testing `AUTH_METHOD=PROXY_HEADER` | ||
|
||
This is a minimal example for testing the `PROXY_HEADER` auth method. | ||
Here a Caddy sets the headers as if they were configured by an auth | ||
service. | ||
|
||
Usage: | ||
|
||
make run | ||
|
||
Testing: | ||
|
||
- On <http://localhost:8080> the otterwiki is listening, no header is | ||
set. The access results in a 403 Forbidden | ||
- On <http://localhost:8081> a caddy server is listening, which does a | ||
reverse proxy into the otterwiki service with additional headers | ||
providing information about the user. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
services: | ||
otterwiki: | ||
build: ../../.. | ||
restart: unless-stopped | ||
ports: | ||
# forward the http port to 8080 | ||
- "8080:80" | ||
environment: | ||
- SITE_NAME=Otter Header Auth | ||
- AUTH_METHOD=PROXY_HEADER | ||
- READ_ACCESS=APPROVED | ||
- WRITE_ACCESS=APPROVED | ||
- ATTACHMENT_ACCESS=APPROVED | ||
caddy: | ||
image: caddy:2 | ||
container_name: caddy | ||
restart: unless-stopped | ||
ports: | ||
- 8081:8081 | ||
volumes: | ||
- ./Caddyfile:/etc/caddy/Caddyfile:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters