# Configurer Tomcat pour utiliser un serveur proxy

## Procédure

1. Arrêtez votre serveur Tomcat.
2. Paramétrez la configuration. Le fichier de configuration est &lt;TomcatPath&gt;/bin/setenv.sh. Si le fichier n'existe pas, créez-le.
3. Ajoutez les paramètres suivants en les modifiant pour les adapter à votre configuration :
   ```
   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.
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyPort=YourHttpProxyPort # Specify the port number of your proxy server.
   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.
   ```

   Par exemple :
   ```
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyHost=proxy.server.com 
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyPort=3128
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1"
   ```

   Si vous utilisez un proxy avec une authentification, allez dans le fichier &lt;tomcat\_path&gt;/WEB-INF/classes/configuration.properties et décommentez les lignes suivantes :
   * proxy avec le protocole HTTP :
     ```
     #http.proxyUser=someuser
     #http.proxyPassword=somepassword
     ```
   * proxy avec le protocole HTTPS :
     ```
     #https.proxyUser=someuser
     #https.proxyPassword=somepassword
     ```

   Pour plus d'informations concernant la configuration du proxy, consultez https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html.
4. Redémarrez votre serveur Tomcat.