Inspecting http traffic from the java code

Enonic version: 6.11.1
OS: Windows 8.1

I’m adding a custom header to all http calls originating from the java code. I don’t have access to the receiving end so I’m trying to inspect the traffic with Fiddler. Fiddler needs some variables added to the JVM for it to show the calls originating from the java code.

-DproxySet=true
-DproxyHost=127.0.0.1
-DproxyPort=8888
-Djavax.net.ssl.trustStore=<path\to\FiddlerKeystore>
-Djavax.net.ssl.trustStorePassword=<Keystore Password>

I’ve tried adding it to server.bat, but can’t get it to work. Am I looking in the wrong place? Is there a better way to do this?

I’m not sure the trustStore parameters will work, but for the proxy try with these:

-Djava.net.useSystemProxies=true 
-Dhttps.proxyHost=127.0.0.1
-Dhttps.proxyPort=8888 
-Dhttp.proxyHost=127.0.0.1
-Dhttps.proxyPort=8888

I’ve tried adding it to the end of the execute step in server.bat:

"%JAVA_EXE%" %JAVA_OPTS% -Dxp.install="%XP_INSTALL%" -Dfile.encoding=UTF8 %XP_OPTS% -classpath "%XP_INSTALL%\lib\*" com.enonic.xp.launcher.LauncherMain %ARGS% -Djava.net.useSystemProxies=true -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888 -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888

Is this the correct place to put it? It does not seem to have any effect.

I think in Windows you can do this before executing server.bat:

set JAVA_OPTS=Djava.net.useSystemProxies=true -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888 -Dhttp.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888

Or add the line at the beginning of the bat file.

1 Like

When I try this I get an error:

Error: Could not find or load main class Djava.net.useSystemProxies=true

Is there something else that should be added somewhere?

There was a typo in my message, there is a dash missing before the first D. Should be like this:

set JAVA_OPTS=-Djava.net.useSystemProxies=true -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888 -Dhttp.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888

1 Like