Http request to an URL throwing error


I am getting error message when using httpClientlib PKIX path building failed: unable to find valid certification path to requested target

(Edit: Added missing equal sign)


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"


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

1 Like

Hi Diego,

# 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;