title: How to configure maven settings.xml to access nexus behind an apache proxy
body: <p>I'm having trouble with getting artifacts from nexus and I hope that the community can help me out. It is not a problem to access and work in the nexus web application (I've set the Base URL to <a href="https://www.fakesitename.com/nexus" rel="nofollow">https://www.fakesitename.com/nexus</a>).</p>
  
  <p>All calls to <a href="https://www.fakesitename.com/nexus" rel="nofollow">https://www.fakesitename.com/nexus</a> is redirected / forwarded / proxied (what's the correct terminology?) to an internal server on the network</p>
  
  <pre><code>&lt;VirtualHost *:443&gt;
    ServerName www.fakesitename.com
    ServerAdmin webmaster@mysite.com
  
    DocumentRoot /var/www
    &lt;Directory /&gt;
      Options FollowSymLinks
      AllowOverride None
    &lt;/Directory&gt;
  
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
  
    &lt;Proxy *&gt;
      AddDefaultCharset Off
      Order deny,allow
      Allow from all
    &lt;/Proxy&gt;
  
    ProxyRequests Off
    ProxyPreserveHost On
  
    ProxyPass /nexus http://192.168.0.178:8081/nexus
    ProxyPassReverse /nexus http://192.168.0.178:8081/nexus
  
    SSLEngine on
    SSLCertificateFile /certs/mysite/ssl.crt
    SSLCertificateKeyFile /certs/mysite/ssl.key
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The settings.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
            http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;
    &lt;mirrors&gt;
      &lt;mirror&gt;
        &lt;id&gt;public&lt;/id&gt;
        &lt;mirrorOf&gt;*&lt;/mirrorOf&gt;
        &lt;url&gt;https://www.fakesitename.com/nexus/content/groups/public&lt;/url&gt;
      &lt;/mirror&gt;
    &lt;/mirrors&gt;
  
  &lt;!-- What should be in here?
    &lt;proxies&gt;
      &lt;proxy&gt;
        &lt;id&gt;myproxy&lt;/id&gt;
        &lt;active&gt;true&lt;/active&gt;
        &lt;protocol&gt;https&lt;/protocol&gt;
        &lt;host&gt;www.fakesitename.com&lt;/host&gt;
        &lt;port&gt;443&lt;/port&gt;
        &lt;nonProxyHosts&gt;127.0.0.1|192.168.0.178&lt;/nonProxyHosts&gt;
      &lt;/proxy&gt;
    &lt;/proxies&gt;
  --&gt;
    &lt;servers&gt;
      &lt;server&gt;
        &lt;id&gt;releases&lt;/id&gt;
        &lt;username&gt;deployment&lt;/username&gt;
        &lt;password&gt;deployment123&lt;/password&gt;
      &lt;/server&gt;
      &lt;server&gt;
        &lt;id&gt;snapshots&lt;/id&gt;
        &lt;username&gt;deployment&lt;/username&gt;
        &lt;password&gt;deployment123&lt;/password&gt;
      &lt;/server&gt;
    &lt;/servers&gt;
    &lt;profiles&gt;
      &lt;profile&gt;
        &lt;id&gt;nexus&lt;/id&gt;
        &lt;repositories&gt;
          &lt;repository&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;url&gt;https://www.fakesitename.com/nexus/content/groups/public&lt;/url&gt;
            &lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;
            &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
          &lt;/repository&gt;
        &lt;/repositories&gt;
        &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
            &lt;id&gt;central&lt;/id&gt;
            &lt;url&gt;https://www.fakesitename.com/nexus/content/groups/public&lt;/url&gt;
            &lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;
            &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
          &lt;/pluginRepository&gt;
        &lt;/pluginRepositories&gt;
      &lt;/profile&gt;
    &lt;/profiles&gt;
    &lt;activeProfiles&gt;
      &lt;activeProfile&gt;nexus&lt;/activeProfile&gt;
    &lt;/activeProfiles&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>When I run for instance <em>mvn clean</em> of a project with the proxies section outcommented I get <em>...peer not authenticated...</em></p>
  
  <pre><code> [INFO] Scanning for projects...
   Downloading: https://www.fakesitename.com/nexus/content/groups/public/com/fakesitename/poms/super/1.3/super-1.3.pom
  [ERROR] The build could not read 1 project -&gt; [Help 1]
  [ERROR]   
  [ERROR]   The project com.fakesitename.library:application:1.3-SNAPSHOT (/tmp/application/pom.xml) has 1 error
  [ERROR]     Non-resolvable parent POM: Could not transfer artifact com.fakesitename.poms:super:pom:1.3 from/to public (https://www.fakesitename.com/nexus/content/groups/public): peer not authenticated and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -&gt; [Help 2]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
  [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
  </code></pre>
  
  <p>j</p>
  
  <p>and with the section not outcommented</p>
  
  <pre><code>[INFO] Scanning for projects...
  Downloading: https://www.fakesitename.com/nexus/content/groups/public/com/fakesitename/poms/super/1.3/super-1.3.pom
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException) caught when connecting to the target host: The target server failed to respond
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: Retrying connect
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException) caught when connecting to the target host: The target server failed to respond
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: Retrying connect
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException) caught when connecting to the target host: The target server failed to respond
  mar 24, 2013 10:12:39 EM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
  INFO: Retrying connect
  [ERROR] The build could not read 1 project -&gt; [Help 1]
  [ERROR]   
  [ERROR]   The project com.fakesitename.library:application:1.3-SNAPSHOT (/tmp/application/pom.xml) has 1 error
  [ERROR]     Non-resolvable parent POM: Could not transfer artifact com.fakesitename.poms:super:pom:1.3 from/to public (https://www.fakesitename.com/nexus/content/groups/public): The target server failed to respond and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -&gt; [Help 2]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
  [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
  </code></pre>
  
  <p>If I change the settings file to use
      <code>http://192.168.0.178:8081</code>
  directly, it succeeds.</p>
  
  <pre><code>[INFO] Scanning for projects...
  Downloading: http://192.168.0.178:8081/nexus/content/groups/public/com/fakesitename/poms/super/1.3/super-1.3.pom
  Downloaded: http://192.168.0.178:8081/nexus/content/groups/public/com/fakesitename/poms/super/1.3/super-1.3.pom (33 KB at 157.3 KB/sec)
  [INFO] ------------------------------------------------------------------------
  [INFO] Reactor Build Order:
  [INFO] 
  ...
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.243s
  [INFO] Finished at: Sun Mar 24 22:22:01 CET 2013
  [INFO] Final Memory: 6M/17M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>So, I really don't know what to do. I want to be able to use the "official" https address in the settings.xml file</p>