With the following nginx config you can expose a single file from Artifactory without need to authenticate.
Be sure that you only expose the files that are allowed to be public
I dont't recommend to run this nginx in the public internet. Run it only inside your company's firewall!
No warranty, that is totally safe.
The file is exposed using proxy pass. There must be an Artifactory token, which will be send from nginx to Artifactory.
The proxy_hide_header
headers make sure, that there is no Cookie sent to the user, which belongs to the Artifactory token.
The caching is recommended to decrease the load on Artifactory.
The mime type mapping using $custom_content_type
is optional, if you need to correct your Content-Type headers, sent to the user.
You can also mount the token via a secret:
nginx.conf
server {
include /secrets/secret.txt;
...
proxy_set_header X-JFrog-Art-Api "$AuthValue;"
}
secret.txt
set $AuthValue "AKsomething123456789";