You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2023/01/10 05:17:04 UTC
[GitHub] [druid] cryptoe commented on a diff in pull request #13489: Add an option to enable HSTS in druid services
cryptoe commented on code in PR #13489:
URL: https://github.com/apache/druid/pull/13489#discussion_r1065341464
##########
server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerInitUtils.java:
##########
@@ -122,4 +127,25 @@ public static void addAllowHttpMethodsFilter(ServletContextHandler root, List<St
null
);
}
+
+ public static void maybeAddHSTSPatternRule(ServerConfig serverConfig, RewriteHandler rewriteHandler)
+ {
+ if (serverConfig.isEnableHSTS()) {
+ rewriteHandler.addRule(getHSTSHeaderPattern());
+ }
+ }
+
+ public static void maybeAddHSTSRewriteHandler(ServerConfig serverConfig, HandlerList handlerList)
+ {
+ if (serverConfig.isEnableHSTS()) {
+ RewriteHandler rewriteHandler = new RewriteHandler();
+ rewriteHandler.addRule(getHSTSHeaderPattern());
+ handlerList.addHandler(rewriteHandler);
+ }
+ }
+
+ private static HeaderPatternRule getHSTSHeaderPattern()
+ {
+ return new HeaderPatternRule("*", "Strict-Transport-Security", "max-age=63072000; includeSubDomains");
Review Comment:
+1. We can keep this as default and add a new config param which overrides this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org