Skip to content

Commit 527fb66

Browse files
committed
Merge pull request 'Fix #24374: configuring same-site cookie policy' (#34) from feature/24374 into develop
2 parents 9051682 + 2015659 commit 527fb66

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/eu/openanalytics/containerproxy/ContainerProxyApplication.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.core.env.Environment;
4040
import org.springframework.data.redis.connection.RedisConnectionFactory;
4141
import org.springframework.session.data.redis.config.ConfigureRedisAction;
42+
import org.springframework.session.web.http.DefaultCookieSerializer;
4243
import org.springframework.web.filter.FormContentFilter;
4344

4445
import javax.annotation.PostConstruct;
@@ -62,6 +63,9 @@ public class ContainerProxyApplication {
6263
@Inject
6364
private ProxyMappingManager mappingManager;
6465

66+
@Inject
67+
private DefaultCookieSerializer defaultCookieSerializer;
68+
6569
private final Logger log = LogManager.getLogger(getClass());
6670

6771
public static void main(String[] args) {
@@ -88,6 +92,10 @@ public void init() {
8892
if (environment.getProperty("server.use-forward-headers") != null) {
8993
log.warn("WARNING: Using server.use-forward-headers will not work in this ShinyProxy release. See https://shinyproxy.io/documentation/security/#https-ssl--tls on how to change your configuration.");
9094
}
95+
96+
String sameSiteCookie = environment.getProperty("proxy.same-site-cookie", "Lax");
97+
log.debug("Setting sameSiteCookie policy to {}" , sameSiteCookie);
98+
defaultCookieSerializer.setSameSite(sameSiteCookie);
9199
}
92100

93101
@Bean

0 commit comments

Comments
 (0)