Skip to content

Commit 558720e

Browse files
committed
Fix #30977: add warnings for invalid session configuration
1 parent 06c9b77 commit 558720e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public void init() {
162162
log.warn("WARNING: Invalid configuration detected: same-site-cookie policy is set to None, but secure-cookies are not enabled. Secure cookies must be enabled when using None as same-site-cookie policy ");
163163
}
164164

165-
166165
if (environment.getProperty("proxy.store-mode", "").equalsIgnoreCase("Redis")) {
167166
if (!environment.getProperty("spring.session.store-type", "").equalsIgnoreCase("redis")) {
168167
// running in HA mode, but not using Redis sessions
@@ -178,6 +177,20 @@ public void init() {
178177
}
179178
}
180179

180+
if (environment.getProperty("spring.session.store-type", "").equalsIgnoreCase("redis")) {
181+
if (!environment.getProperty("proxy.store-mode", "").equalsIgnoreCase("Redis")) {
182+
// using Redis sessions, but not running in HA mode -> this does not make sense
183+
// even with one replica, the HA mode should be used in order for the server to survive restarts (which is the reason Redis sessions are used)
184+
log.warn("WARNING: Invalid configuration detected: user sessions are stored in Redis, but store-more is not set to Redis. Change store-mode so that app sessions are stored in Redis!");
185+
}
186+
if (environment.getProperty( PROPERTY_RECOVER_RUNNING_PROXIES, Boolean.class, false) ||
187+
environment.getProperty( PROPERTY_RECOVER_RUNNING_PROXIES_FROM_DIFFERENT_CONFIG, Boolean.class, false) ) {
188+
// using Redis sessions together with app recovery -> this does not make sense
189+
// if already using Redis for sessions there is no reason to not store app sessions
190+
log.warn("WARNING: Invalid configuration detected: user sessions are stored in Redis and App Recovery is enabled. Instead of using App Recovery, change store-mode so that app sessions are stored in Redis!");
191+
}
192+
}
193+
181194
boolean hideSpecDetails = environment.getProperty(PROP_API_SECURITY_HIDE_SPEC_DETAILS, Boolean.class, true);
182195
if (!hideSpecDetails) {
183196
log.warn("WARNING: Insecure configuration detected: The API is configured to return the full spec of proxies, " +

0 commit comments

Comments
 (0)