in grails-forge-api/src/main/java/org/grails/forge/api/bind/RequestInfoArgumentBinder.java [63:89]
private String resolveUrl(HttpRequest<?> request) {
String cp = configuration.getPath().orElse("");
String url = configuration.getUrl().map(Object::toString).orElse(null);
if (url != null) {
if (url.startsWith("https://")) {
return url + cp;
} else {
return "https://" + url + cp;
}
} else {
String hostname = request.getUri().getHost();
String host;
if (hostname != null) {
host = hostname;
} else {
host = SocketUtils.LOCALHOST;
}
int port = request.getServerAddress().getPort();
if (port > -1 && port != 80) {
host = host + ":" + port;
}
url = (request.isSecure() ? "https" : "http") + "://" + host + cp;
}
return url;
}