Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Nginx rules to f5 irules

Sara123
Nimbostratus
Nimbostratus

Hi,

I would need some help in converting the below nginx rules to f5 irules.

location ~ ^/$ {
proxy_pass http://artifactory/ui/$1;

}

location / {

location ~ ^/$ {
proxy_pass http://artifactory/ui/ proxy_read_timeout 2400s;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_max_temp_file_size 0;
# proxy_buffer_size 128k;
# proxy_buffers 40 128k;
# proxy_busy_buffers_size 128k;
location ~ ^/ui {
proxy_pass http://artifactory;

}
proxy_pass http://artifactory-direct/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# add_header Strict-Transport-Security always;
}
location ~ ^/artifactory/ {
proxy_pass http://artifactory-direct;
}

2 REPLIES 2

crecent654
Nimbostratus
Nimbostratus

The equivalent F5 iRule for the provided nginx configuration would look like this:

when HTTP_REQUEST { if { [HTTP::uri] eq "/" } { set uri "/" set uri [string map { "/" "" } $uri] pool artifactory_pool pool-member artifactory_pool 10.0.0.1 8080 HTTP::path "/ui/$uri" } else { pool artifactory_pool pool-member artifactory_pool 10.0.0.1 8080 HTTP::path "/artifactory[HTTP::path]" HTTP::header insert X-Artifactory-Override-Base-Url "http://$host" HTTP::header insert X-Forwarded-Port $server_port HTTP::header insert X-Forwarded-Proto $http_x_forwarded_proto HTTP::header insert Host $http_host HTTP::header insert X-Forwarded-For $client_ip # HTTP::header insert Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" } }

when HTTP_RESPONSE { HTTP::header replace Server "f5-httpd" }  Dashboard Anywhere Login

Note that you will need to update the pool member IP address and port to match your environment. Also, the commented out Strict-Transport-Security header can be enabled if needed.

JRahm
Community Manager
Community Manager

Hi @Sara123 is this a pretty standard artifactory deployment? I'm not super skilled with nginx proxypass configs, and as posted chatgpt is not doing me any favors in an attempted conversion. That said, I have 2 references from jfrog, the first for nginx and the second for f5...might give you some pointers on getting toward the f5 solution, which on the surface seems a lot less complex.