diff --git a/src/main/java/com/commafeed/frontend/CommaFeedApplication.java b/src/main/java/com/commafeed/frontend/CommaFeedApplication.java index 890ba37f..c743b0a4 100644 --- a/src/main/java/com/commafeed/frontend/CommaFeedApplication.java +++ b/src/main/java/com/commafeed/frontend/CommaFeedApplication.java @@ -116,7 +116,13 @@ public class CommaFeedApplication extends AuthenticatedWebApplication { public String renderUrl(Url url) { String publicUrl = applicationSettingsService.get().getPublicUrl(); if (StringUtils.isNotBlank(publicUrl)) { - url.setProtocol(Url.parse(publicUrl).getProtocol()); + Url parsed = Url.parse(publicUrl); + + String protocol = parsed.getProtocol(); + url.setProtocol(protocol); + + Integer port = parsed.getPort(); + url.setPort(port != null ? port : StringUtils.equalsIgnoreCase(protocol, "http") ? 80 : 443); } return super.renderUrl(url); }