File tree Expand file tree Collapse file tree 2 files changed +12
-28
lines changed
Expand file tree Collapse file tree 2 files changed +12
-28
lines changed Original file line number Diff line number Diff line change 5353 handle /pgadmin* {
5454 forward_auth localhost:{args[0]} {
5555 uri /rpc/auth_gate
56- copy_headers Cookie
56+
57+ # Handle unauthorized - redirect to login
58+ @unauthorized status 401
59+ handle_response @unauthorized {
60+ redir /?login=required&redirect={uri} 302
61+ }
5762 }
5863 reverse_proxy localhost:{$PGADMIN_PORT:5050} {
5964 header_up Host {host}
7378 reverse_proxy localhost:{args[1]}
7479 }
7580
76- # Auth gate endpoint (for pgAdmin forward_auth)
77- handle /rest/rpc/auth_gate {
78- reverse_proxy localhost:{args[1]}
79- }
80-
8181 # Next.js application (catch-all)
8282 handle {
8383 reverse_proxy localhost:{args[0]}
8484 }
8585}
8686
87- (error_handlers) {
88- handle_errors {
89- @unauthorized expression {http.error.status_code} == 401
90- handle @unauthorized {
91- redir /?login=required&redirect={uri} 302
92- }
93- }
94- }
95-
9687# =============================================================================
9788# TENANT SITE BLOCKS
9889# =============================================================================
10192ma.statbus.org {
10293 import pgadmin_route 3023
10394 import tenant_routes 3022 3023
104- import error_handlers
10595}
10696
10797# Norway tenant (slot offset 3: ports 3030-3035)
10898no.statbus.org {
10999 import pgadmin_route 3033
110100 import tenant_routes 3032 3033
111- import error_handlers
112101}
113102
114103# Albania tenant (slot offset 4: ports 3040-3045)
115104al.statbus.org {
116105 import pgadmin_route 3043
117106 import tenant_routes 3042 3043
118- import error_handlers
119107}
120108
121109# =============================================================================
Original file line number Diff line number Diff line change 3939 # The {args[0]} placeholder receives the tenant's REST port
4040 forward_auth localhost:{args[0]} {
4141 uri /rpc/auth_gate
42- # Copy cookies for JWT authentication
43- copy_headers Cookie
42+
43+ # Handle unauthorized - redirect to login
44+ @unauthorized status 401
45+ handle_response @unauthorized {
46+ redir /?login=required&redirect={uri} 302
47+ }
4448 }
4549
4650 # If authenticated, proxy to shared pgAdmin
5256 header_up X-Forwarded-Host {host}
5357 }
5458 }
55-
56- # Redirect unauthenticated users to login page
57- handle_errors {
58- @unauthorized expression {http.error.status_code} == 401
59- handle @unauthorized {
60- redir /?login=required&redirect=/pgadmin 302
61- }
62- }
6359}
6460
6561# Example tenant site blocks (customize for your deployment)
You can’t perform that action at this time.
0 commit comments