2

So far, I have learned to ways to set HTTP proxy with camel.

  • First one is to append proxy information with destination URI

    <to uri="http://sample.com?proxyAuthHost=proxy.example.com&amp;proxyPort=8080"/>
    
  • Other approach is setting proxy global to CamelContext

    <properties>
        <property key="http.proxyHost" value="proxy.example.com"/>
        <property key="http.proxyPort" value="8080"/>
    </properties>
    

    Other than these approaches, is there any way by which I can configure proxy globally so that, I don't have repeat this procedure for each URI or for each CamelContext? For example, if I configure proxy in a properties file, how can I use it(Other than using property using {{key}} approach)?

niyasc
  • 4,440
  • 1
  • 23
  • 50

2 Answers2

3

You should edit the setenv file of Karaf, located in bin/ folder under your JBoss Fuse installation. In that file, add the properties linked by Claus' answer to EXTRA_JAVA_OPTS variable.

On Linux edit bin/setenv

EXTRA_JAVA_OPTS="-Dhttp.proxyHost=10.0.0.100 -Dhttp.proxyPort=8800"
export EXTRA_JAVA_OPTS

On Windows edit bin/setenv.bat

SET EXTRA_JAVA_OPTS=-Dhttp.proxyHost=10.0.0.100 -Dhttp.proxyPort=8800

Then start JBoss Fuse, those options will be added to Java command line by bin/fuse script.

bin/fuse script calls bin/karaf which imports such variable from bin/setenv.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64
1

You can configure the http proxy settings as JVM parameters. There is other SO questions about this such as: How do I set the proxy to be used by the JVM

Community
  • 1
  • 1
Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Thanks for the response. I am deploying my project on JBOSS Fuse. In that case, where should I set the proxy? – niyasc Nov 14 '16 at 08:31