Skip to content

Commit

Permalink
Merge pull request #1226 from sbeigel/secure-websocket-fix
Browse files Browse the repository at this point in the history
#1237 Use secure websocket protocol for secure pages
  • Loading branch information
xael-fry authored May 25, 2018
2 parents 9308a98 + a3a010c commit 7ac0146
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/src/play/mvc/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public static String getFullUrl(String action, Map<String, Object> args) {
ActionDefinition actionDefinition = reverse(action, args);
String base = getBaseUrl();
if (actionDefinition.method.equals("WS")) {
return base.replaceFirst("https?", "ws") + actionDefinition;
return base.replaceFirst("http:", "ws:").replaceFirst("https:", "wss:") + actionDefinition;
}
return base + actionDefinition;
}
Expand Down Expand Up @@ -790,7 +790,7 @@ public void absolute() {
url = (isSecure ? "https://" : "http://") + hostPart + url;
}
if (method.equals("WS")) {
url = url.replaceFirst("https?", "ws");
url = isSecure ? url.replaceFirst("https:", "wss:") : url.replaceFirst("http:", "ws:");
}
}
}
Expand Down

0 comments on commit 7ac0146

Please sign in to comment.