Skip to main content

HTTP and HTTPS Request and Proxy Settings

Nexus Repository uses HTTP requests to fetch content from remote servers configured as proxy repositories. Management of these settings allows administrators to control outbound request retries in case of what looks like a temporary failure in making a request.

Partial view of HTTP configuration screen

HTTP and HTTPS Settings

The following configurations are available under Administration → System → HTTP in the Nexus Repository user interface. Users require the nx-settings privilege to view and edit these settings.

User-Agent Customization

The HTTP configuration in User-agent customization allows you to append a string to the User-Agent HTTP header field. This can be a required customization by your proxy servers.

Connection/Socket Timeout

The Connection/Socket Timeout configuration controls the amount of time (in seconds) that Nexus Repository waits for a request to succeed when interacting with an external remote repository. This defaults to 30 seconds.

Connection/Socket Retry Attempts

The Connection/Socket Retry Attempts configuration controls the number of retry attempts Nexus Repository makes when requests fail. This defaults to 2.

Exceptions to Retry Attempts

There are some IOException subclasses that the HttpClient considers non-retryable. More specifically, they are:

  • InterruptedIOException

    Signals that an I/O operation has been interrupted. An InterruptedIOException is thrown to indicate that an input or output transfer has been terminated because the thread performing it was interrupted.

  • ConnectException

    Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the connection was refused remotely (e.g., no process is listening on the remote address/port).

  • UnknownHostException

    A Java Unknown Host Exception is an error that occurs in Java applications when the application is unable to find or connect to an IP address or hostname. This can also occur if the requested IP address is not valid.

  • SSLException

    An error that occurs when a client and server are attempting to communicate using the secure SSL protocol, but there is a problem with the connection.

  • NoRouteToHostException

    Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.

Proxy Settings

If your Nexus Repository instance needs to reach public repositories like the Central Repository via a proxy server, you can configure those HTTP and/or HTTPS connections in the Proxy Settings section. This is a critical initial step for many Sonatype Nexus Repository deployments as most environments are typically secured via an HTTP/HTTPS proxy server for all outgoing internet traffic.

HTTP Authentication and HTTPS Authentication sections of HTTP Configuration form

HTTP Configuration

In the Proxy Settings section, select the Enable HTTP proxy checkbox to configure an HTTP proxy.

Nexus Repository 3 HTTP Proxy Settings

Specify an IP address or DNS name in the HTTP Proxy Host field; this should not be a URL.

Provide your HTTP proxy server's port number in the HTTP Proxy Port field.

HTTP Authentication

If your HTTP proxy server requires authentication, select the Enable HTTP Authentication checkbox to provide authentication details. Then, enter either a username and password or Windows NTLM hostname and domain (if using a Windows NT LAN Manager).

HTTPS Configuration

In the Proxy Settings section, select the Enable HTTPS proxy checkbox to configure an HTTPS proxy.

HTTPS-Auth-Config.png

Specify an IP address or DNS name in the HTTPS Proxy Host field; this should not be a URL.

Provide your HTTPS proxy server's port number in the HTTP Proxy Port field.

HTTPS Authentication

If your HTTPS proxy server requires authentication, select the Enable HTTPS Authentication checkbox to provide authentication details. Then, enter either a username and password or Windows NTLM hostname and domain (if using a Windows NT LAN Manager).

Hosts to exclude from HTTP/HTTPS Proxy

The Hosts to exclude from HTTP/HTTPS Proxy field configures hosts for Nexus Repository to reach directly, ignoring the proxy settings. These requests do not go through the configured HTTP/HTTPS proxy.

  • Provide a hostname; then, select the plus sign (+) button to add the host.

  • Use the star (*) character as a wildcard to match numerous host names (e.g., *.example.com).

  • Remove hosts from the list using the x button.

Default HTTP Settings in Nexus Repository 3

The default HTTP settings in Nexus Repository 3 are as follows:

Setting

Default Value

Description

Connection/Socket Retry Attempts

2

The number of times Nexus Repository will automatically retry a request to a remote server if the initial request fails.

Connection/Socket Timeout

30 seconds

The maximum amount of time that Nexus Repository will wait while trying to establish an initial connection to a remote server.

Request Timeout

20 seconds

After Nexus Repository has already established an initial connection with a remote server, the Request Timeout configuration controls the amount of time Nexus Repository will wait for a response to a specific request.

Keep Alive Duration

30 seconds

The duration to keep connections open for reuse

Buffer Size

8k bytes

The maximum number of bytes that can be buffered when reading or writing a response or request content.