Put the JVM options before -jar. This should work:
java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128 -jar my-application.war
Explanation
According to java command-line documentation, the command's syntax is:
java [ options ] -jar file.jar [ arguments ]
The arguments are the args that'll be received in your main(String[] args). So, it's totally your responsibility to use them somehow. And if you forward them to spring using SpringApplication.run(MyApplication.class, args);, then you need to find documentation that says how spring uses args in the run method.
The options, however, are not sent to your app. One of their uses is to set what java calls system properties using -Dproperty=value. According to Java Networking and Proxies, setting, e.g., http.proxyHost property makes the JVM proxy all your http request through that host.
java -jar my-application.war -Dhttp.proxyHost localhost -Dhttp.proxyPort=3128 -Dhttps.proxyHost localhost -Dhttps.proxyPort=3128X-Forwarded-ForandX-Forwarded-Protoheaders, or customize your embedded Tomcat server by specifying theserver.tomcat.remote-ip-headerandserver.tomcat.protocol-headersettings. Also, make sure you haveserver.use-forward-headers=trueinapplication.properties. From docs.spring.io/spring-boot/docs/current/reference/html/…host, port, {username, password}. I have no control over the proxy server so can't configure custom headers. How would I use the above given my proxy is running onhttp://localhost:3128