Browse Source

Add back request heades modifiers as prime app

pull/58/head
Kristijan Mitrovic 4 years ago
parent
commit
bc21d8d8ad
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      bubble-server/src/main/java/bubble/service/stream/StandardAppPrimerService.java

+ 16
- 0
bubble-server/src/main/java/bubble/service/stream/StandardAppPrimerService.java View File

@@ -177,6 +177,7 @@ public class StandardAppPrimerService implements AppPrimerService {
final Set<String> whiteListDomains = new HashSet<>();
final Set<String> filterDomains = new HashSet<>();
final Set<String> flexExcludeDomains = new HashSet<>();
final Set<String> requestHeaderModifiers = new HashSet<>();

boolean areAllSetsEmpty = true;
for (AppMatcher matcher : matchers) {
@@ -218,6 +219,16 @@ public class StandardAppPrimerService implements AppPrimerService {
areAllSetsEmpty = areAllSetsEmpty && empty(filters);
}

final Set<String> modifiers = appRuleDriver.getPrimedResponseHeaderModifiers();
if (empty(modifiers)) {
log.debug("_primeApp: no responseHeaderModifiers for device/app/rule/matcher: "
+ device.getName() + "/" + app.getName() + "/" + rule.getName() + "/"
+ matcher.getName());
} else {
requestHeaderModifiers.addAll(modifiers);
areAllSetsEmpty = areAllSetsEmpty && empty(modifiers);
}

if (account.isFirstAdmin() && flexDomains == null) {
final Set<String> flexes = appRuleDriver.getPrimedFlexDomains();
if (empty(flexes)) {
@@ -261,6 +272,11 @@ public class StandardAppPrimerService implements AppPrimerService {
AppRuleDriver.defineRedisFilterSet(redis, ip, app.getName() + ":" + app.getUuid(),
filterDomains.toArray(String[]::new));
}
if (!empty(requestHeaderModifiers)) {
AppRuleDriver.defineRedisResponseHeaderModifiersSet(
redis, ip, app.getName() + ":" + app.getUuid(),
requestHeaderModifiers.toArray(String[]::new));
}
if (account.isFirstAdmin()) {
if (!empty(flexDomains)) {
if (!empty(flexExcludeDomains)) flexDomains.removeAll(flexExcludeDomains);


Loading…
Cancel
Save