when config the grails config location as below
grails.config.locations = [
"https://ip:8443/config/Config.groovy"
]
will get the below warning message in log
2018-11-28 19:04:22,682 WARN ConfigurationHelper - Unable to load specified config location https://ip:8443/config/Config.groovy : File does not exist.
but I can access https://ip:8443/config/Config.groovy directly from the browser.
In org.codehaus.groovy.grails.commons.cfg.ConfigurationHelper.mergeInLocations()
private static void mergeInLocations(ConfigObject config, List locations, PathMatchingResourcePatternResolver resolver, ClassLoader classLoader) {
...
def resource = resolver.getResource(location.toString())
if(resource.exists()) {
...
} else {
LOG.warn "Unable to load specified config location $location : File does not exist."
}
}
the resolver is the org.springframework.core.io.support.PathMatchingResourcePatternResolver in spring. and resolver.getResource(location.toString()) result will be a org.springframework.core.io.UrlResource
and UrlResource.exists() code is like
public boolean exists() {
...
try {
URLConnection con = url.openConnection();
HttpURLConnection httpCon =
(con instanceof HttpURLConnection ? (HttpURLConnection) con : null);
if (httpCon != null) {
int code = httpCon.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
return true;
}
else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
return false;
}
}
}catch(IOException ex){
return false;
}
}
and since its https , it will throw java.security.cert.CertificateException: No subject alternative names present when httpCon.getResponseCode().
so UrlResource is not for https resource? what should I do if I want to load the https resource? thanks.