Skip to content

Commit fcf129e

Browse files
authored
Extend docs with Caddy SAML issue (#616)
1 parent c65463f commit fcf129e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

collections/_documentation/saml.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,28 @@ Your user account might be migrated to a new username, which is used during the
191191

192192
Please check the username in your user profile and use it for API authentication.
193193

194-
### Proxy and http vs https
194+
### Proxy and URL mismatch
195195

196-
**Error:**
197-
The response was received at `http://kimai-test.example.com/auth/saml/acs` instead of `https://kimai-test.example.com/auth/saml/acs`
196+
**Error:**
197+
"The response was received at `**http:**//kimai-test.example.com/auth/saml/acs` instead of `**https:**//kimai-test.example.com/auth/saml/acs`
198+
199+
or
200+
201+
"The response was received at `https://kimai-test.example.com**:8001**/auth/saml/acs` instead of `https://kimai-test.example.com/auth/saml/acs`"
202+
203+
**Solution:**
204+
This could have multiple root causes:
205+
206+
1. You've configured the `baseurl` incorrectly. It should be `https://kimai-test.example.com/auth/saml/` (don't forget flush the cache!)
207+
2. You've misconfigured the `TRUSTED_PROXIES` property. Make sure it's configured correctly.
208+
3. Your proxy is not setting the `X-Forwarded-...` headers. Make sure your proxy is setting all the headers `X-Forwarded-Proto`, `X-Forwarded-Host`, `X-Forwarded-For` and `X-Forwarded-Port`
209+
* e.g. the proxy Caddy does not set the `X-Forwarded-Port` header by default ([GitHub Discussion](https://github.com/kimai/kimai/discussions/5658#discussioncomment-14749244))
210+
211+
To make Caddy set the `X-Forwarded-Port` header add it with the `header_up` config in your Caddyfile as follows:
212+
213+
<our-domain> {
214+
reverse_proxy kimai:8001 {
215+
header_up X-Forwarded-Port {http.request.local.port}
216+
}
217+
}
198218

199-
**Solution:**
200-
Use the `baseurl` configuration and set it to `https://kimai-test.example.com/auth/saml/` (and flush the cache!)

0 commit comments

Comments
 (0)