Commit 6e49e621 authored by Ard Schrijvers's avatar Ard Schrijvers

HSTTWO-4493 Allow cnd host to start with http or https as well

parent 5195c943
......@@ -196,7 +196,8 @@ public interface VirtualHost {
/**
* @return <code>null</code> or empty String in case no cdn host is used and otherwise the cdn host to be used for URLs to sitemap items that have
* {@link org.hippoecm.hst.configuration.sitemap.HstSiteMapItem#isContainerResource() HstSiteMapItem#isContainerResource() = true}.
* Supported format for a cdn host is //hostname. It is *not* allowed to include the scheme (http:|https:)
* Preferred format for a cdn host is //hostname so it piggybacks on the scheme of the current request. Starting with
* http/https is allowed but is not preferred
*/
String getCdnHost();
......
......@@ -64,7 +64,7 @@ public class VirtualHostService implements MutableVirtualHost {
*/
private String locale;
/**
/**!validCdnHost
* Whether the {@link Mount}'s contained by this VirtualHostService should show the hst version as a response header when they are a preview {@link Mount}
*/
private boolean versionInPreviewHeader;
......@@ -272,9 +272,9 @@ public class VirtualHostService implements MutableVirtualHost {
}
if (StringUtils.isNotBlank(cdnHost) && !validCdnHost(cdnHost)) {
log.error("Ignoring invalid CDN host '{}'. Supported format is : //hostname or //hostname:portnumber. It is not " +
"allowed to start with http: or https: and is not allowed to end with a /. Ignoring configured " +
"cdnHost '{}'.", cdnHost, cdnHost);
log.error("Ignoring invalid CDN host '{}'. Supported formats are http://hostname, https://hostname or " +
"//hostname (hostname can include portnumber). It is not allowed to end with a '/'. " +
"Ignoring invalid configured cdnHost '{}'.", cdnHost, cdnHost);
cdnHost = null;
}
......@@ -406,8 +406,8 @@ public class VirtualHostService implements MutableVirtualHost {
private boolean validCdnHost(final String cdnHost) {
// note, this is a very simple validation, very far from complete. However this is a basic check to avoid
// cdn host starts with scheme or end with a /
if (!cdnHost.startsWith("//")) {
// cdn host ends with with a / or that it doesn't start with https://, http:// or //
if (!cdnHost.startsWith("//") && !cdnHost.startsWith("http://") && !cdnHost.startsWith("https://")) {
return false;
}
if (cdnHost.endsWith("/")) {
......
......@@ -371,8 +371,8 @@
- hst:cacheable (boolean)
- hst:defaultresourcebundleid (string)
// For sitemap items that are marked to be a containerresource (and use ResourceDispatchingPipeline), then in non-channel-manager environment, the
// cndhost is used in the URL if configured. The value is not allowed to contain the scheme, thus do not use http://hostname or
// https://hostname but //hostname
// cndhost is used in the URL if configured. The value is allowed to contain the scheme (http/https) but preferred is to
// have it start with // so it piggybacks on the scheme of the current request
- hst:cdnhost (string)
[hst:virtualhostgroup] > nt:base, mix:referenceable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment