Skip to content

Commit

Permalink
Merge pull request #1841 from CodeNow/unsafe-url
Browse files Browse the repository at this point in the history
Added http preamble to avoid unsafe urls
  • Loading branch information
Myztiq authored Oct 11, 2016
2 parents daf24ed + b9c7fa5 commit 75c14ac
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/services/defaultContainerUrlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ function defaultContainerUrl(
return function (instance) {
var defaultPort = '';
var ports = extractInstancePorts(instance);
var preamble = 'http://';
if (ports.length) {
if (!ports.includes('80')) {
defaultPort = ':' + ports[0];
if (ports.includes('443')) {
preamble = 'https://';
} else {
defaultPort = ':' + ports[0];
}
}
}
return instance.getContainerHostname() + defaultPort;

return preamble + instance.getContainerHostname() + defaultPort;
};
}

0 comments on commit 75c14ac

Please sign in to comment.