Skip to content

Commit 4079257

Browse files
committed
Add cookie to proxied keycloak
1 parent 4e7e9d3 commit 4079257

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/proxy/KeycloakProxyController.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ class KeycloakProxyController (
3737
}.let { targetUri.append(it) }
3838
}
3939

40+
// Extract cookies from the request
41+
val cookies = request.cookies
42+
if (cookies != null) {
43+
val cookieHeader = cookies.joinToString("; ") { "${it.name}=${it.value}" }
44+
// Set the cookies in the proxy request headers
45+
proxy.header("Cookie", cookieHeader)
46+
}
47+
4048
return proxy.uri(targetUri.toString()).get()
4149
}
4250

0 commit comments

Comments
 (0)