Http request to an URL throwing error


#1

Hi,

I am getting error message when using httpClientlib
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


#2

(Edit: Added missing equal sign)

Hi.

Is SNI enabled for the host?
If you’re in a unix-like env, you can activate it by setting the following environment variable.

export JAVA_OPTS="$JAVA_OPTS -Djsse.enableSNIExtension=true"

or

ENV JAVA_OPTS “$JAVA_OPTS -Djsse.enableSNIExtension=true” (if its a Dockerfile)


#3

Hi Diego,

Environment:
# Enonic XP 6.15.5
# Built on 2018-11-02T14:18:38+0100 (hash = 7954a1a5a0818a166c1e07cec62e61b36770d6e5, branch = 6.15)
# Java HotSpot™ Client VM 1.8.0_191 (Oracle Corporation)
# Windows 10 10.0 (x86)

As suggested I have set the environment variable as
set JAVA_OPTS=%JAVA_OPTS% -Djsse.enableSNIExtension=true

Still, no luck. Please suggest. And be informed, I can see valid certificate while accessing from browser.

Do we need any entry similar to below? process.env[‘NODE_TLS_REJECT_UNAUTHORIZED’] = 0;

Thanks,
Vanditha