# Configuring Tomcat to use a proxy server

## Procedure

1. Stop your Tomcat server.
2. Set the configuration according to the way Talend Administration Center is run:
   * If you run Talend Administration Center as a server module.
     1. Go to &lt;TomcatPath&gt;\bin, and edit the setenv.bat file. If the file does not exist, create it.
     2. Add the following parameters, changing the parameters to match with your configuration:
        ```
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyHost=proxy.server.com # Specify the host name or IP address of your HTTP proxy server. You can use this parameter for http and https host names.
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyPort=YourHttpProxyPort # Specify the port number of your proxy server.
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" # Specify a list of hosts separated by "|" that do not require access through your proxy server.
        ```

        For example:
        ```
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyHost=proxy.server.com 
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyPort=3128
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1"
        ```
     3. In case you use a proxy with authentication, go to &lt;tomcat\_path&gt;/WEB-INF/classes/configuration.properties file and uncomment the following lines:
        * proxy with the HTTP protocol:
          ```
          #http.proxyUser=someuser
          #http.proxyPassword=somepassword
          ```
        * proxy with the HTTPS protocol:
          ```
          #https.proxyUser=someuser
          #https.proxyPassword=somepassword
          ```
   * If you run Talend Administration Center as a Windows service, change the Java properties using Windows command prompt:
     1. Run the following commands:
        ```
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.proxyHost=proxy.server.com
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.proxyPort=YourHttpProxyPort
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" 
        ```

        For example:
        ```
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//talend-tac-7.3.1 ++JvmOptions=-Dhttp.proxyHost=proxy.server.com
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//talend-tac-7.3.1 ++JvmOptions=-Dhttp.proxyPort=3128
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//tvalend-tac-7.3.1 ++JvmOptions=-Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" 
        ```

   For more information about proxy configuration, see https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html.
3. Restart your Tomcat server.