2

I'm trying to set up Artifactory (CPP-CE) behind NGINX reverse proxy, with a custom context. I.e. all Artifactory URLs should be behind some top-level context (e.g. /conan). So the UI URL is supposed to be at https://server.com/conan/ui, and repository endpoints behind https://server.com/conan/artifactory.

I can't seem to find a way of telling Artifactory that. The documentation is honestly not particularly helpful.

I've tried setting X-Artifactory-Override-Base-Url to $http_x_forwarded_proto://$host:$server_port/conan/artifactory or $http_x_forwarded_proto://$host:$server_port/conan/, with no effect. The request URL is rewritten to remove /conan part when passing the request to the Artifactory.

Still, attempting to access https://server.com/conan/ui from the browser spits out an HTML with references to /ui/... and accessing https://server.com/conan/artifactory returns a redirect to /ui (completely ignoring any context part that was specified in X-Artifactory-Override-Base-Url)

Is setting it up this way even possible? Do I need to change some configuration inside Artifactory to get this done? I see there is a reverse proxy configuration available through the APIs, but the documentation offers no explanation what does it really do, AFAIU, it just to generate the reverse-proxy block.

The entire NGINX location configuration, for kicks:

        location /conan {
                proxy_read_timeout  2400s;
                proxy_pass_header   Server;
                proxy_cookie_path   /conan/ /;
                rewrite ^/conan/(.*) /$1 break;
                proxy_pass          http://localhost:9082;
                proxy_next_upstream error timeout non_idempotent;
                proxy_next_upstream_tries    1;
                proxy_set_header    X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/conan/artifactory;
                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;
        }
Pawel Veselov
  • 744
  • 8
  • 19

0 Answers0