Skip to content

Commit 76da9a8

Browse files
author
Jarrod Ribble
committed
Merge pull request #2 from jocull/master
Correction for strict locations (rejections on iOS / Safari)
2 parents 1c5891e + 75f2d90 commit 76da9a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/com/netiq/websockify/WebsockifyProxyHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,12 @@ private void setContentTypeHeader(HttpResponse response, File file) {
473473
}
474474

475475
private String getWebSocketLocation(HttpRequest req) {
476-
return "wss://" + req.getHeader(HttpHeaders.Names.HOST);
476+
String prefix = "ws";
477+
String origin = req.getHeader(HttpHeaders.Names.ORIGIN).toLowerCase();
478+
if(origin.contains("https")){
479+
prefix = "wss";
480+
}
481+
return prefix + "://" + req.getHeader(HttpHeaders.Names.HOST) + req.getUri();
477482
}
478483

479484
@Override

0 commit comments

Comments
 (0)