You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Mark the location as internal to prevent direct access
96
+
internal;
97
+
98
+
# Pass request to Tinyauth, do not use the Tinyauth domain here, use the internal Docker network name and port or the IP and port of the Tinyauth instance
94
99
proxy_pass http://tinyauth:3000/api/auth/nginx;
95
100
96
101
# Pass the request headers
97
102
proxy_set_header x-forwarded-proto $scheme;
98
103
proxy_set_header x-forwarded-host $http_host;
99
104
proxy_set_header x-forwarded-uri $request_uri;
100
105
}
101
-
102
-
# Tinyauth login redirect
103
-
location @tinyauth_login {
104
-
return 302 http://tinyauth.example.com/login?redirect_uri=$scheme://$http_host$request_uri; # Replace with your app URL
The `/tinyauth` path can be renamed for convenience.
114
110
:::
@@ -118,19 +114,4 @@ It should look like this:
118
114
technologies like WebSockets.
119
115
:::
120
116
121
-
:::note
122
-
Due to the way Nginx handles forward auth, Tinyauth cannot automatically redirect to the unauthorized page. Thus, users may be redirected to a blank 403 Forbidden page in case of a failed authentication. This can be somehow mitigated by configuring a custom error page for the 403 status code:
123
-
124
-
```sh
125
-
location / {
126
-
# Rest of your configuration
127
-
error_page 403 = @tinyauth_unauthorized;
128
-
}
129
-
130
-
location @tinyauth_unauthorized {
131
-
return 302 http://tinyauth.example.com/unauthorized?username=unavailable;# Replace with your app URL
132
-
}
133
-
```
134
-
:::
135
-
136
117
Save the host configuration. Accessing the protected host will redirect to the Tinyauth login page if not already logged in. Repeat this process for each host to be protected by Tinyauth.
0 commit comments