How to configure Artifactory as a Docker registry with F5 and HTTPS?

How to configure Artifactory as a Docker registry with F5 and HTTPS?

 

The Repository Path method:

 

From Artifactory version 5.8 it is possible to work with Artifactory as a Docker registry with the Repository Path method, which allows to work with Artifactory without the need of a reverse proxy configuration.

 

If you would like to use the Repository Path method and have an HTTPS connection you will need to configure a proxy in front of Artifactory.
Furthermore, in case the proxy is Nginx or Apache, you may simply generate the required configuration for the proxy from Artifactory UI.

 

Otherwise, in case F5 (BIG-IP) is configured in front of Artifactory you may add the following iRule to the Virtual Server configuration in F5:

 

when HTTP_REQUEST {
       set ARTI_PROTO "https"
       HTTP::header insert X-Artifactory-Override-Base-Url "$ARTI_PROTO://<server-name>/artifactory"
       HTTP::header insert X-Forwarded-Proto "$ARTI_PROTO"
}

 

The above iRule should allow you to work with Artifactory as a Docker registry with the Repository Path method and HTTPS connection via F5.

 

 

To configure F5 in order to work with Artifactory as a Docker registry with the Subdomain method and HTTPS connection, the following iRule needs to be configured for the Virtual Server in F5:
 
when HTTP_REQUEST {
  set ARTI_PROTO "https"
   if { [HTTP::host] contains "docker" && [HTTP::uri] starts_with "/v2/" } {
       scan [HTTP::host] %[^.].%[^.].%[^.].%[^.].%s REPO APP ENV DOMAIN TLD
       HTTP::uri /artifactory/api/docker/$REPO[HTTP::uri]
       HTTP::header insert X-Forwarded-Proto "$ARTI_PROTO"
       HTTP::header insert X-Artifactory-Override-Base-Url "$ARTI_PROTO://<server-name>/artifactory"
   }
}
 
The above iRule should allow you to work with Artifactory as a Docker registry with the Subdomain method and HTTPS connection via F5.

*Please refer to our wiki page about Getting Started with Artifactory as a Docker Registry for more information.