Introduction
When users use SSO to login and access Artifactory portal, they want to disable the **/ui/login page to avoid being accessed to login by illegal users.
In other word, disable the below page to make it cannot be accessed;
Resolution
There is using nginx proxy server to redirect to main url when accessing **/ui/login;
Add the below configuration into server block of nginx.conf;
server {
if ($http_cookie ~* "REFRESHTOKEN=([\w-]+?)(?=;|$)") {
set $JSESSIONID_TOKEN "$1";
}
if ( $request_uri ~ ^/ui/login/ ){
set $condition 'a';
}
if ($JSESSIONID_TOKEN = '') {
set $condition "${condition}b";
}
if ($http_authorization = '') {
set $condition "${condition}c";
}
if ($condition = 'abc'){
rewrite ^/* https://myserver.domian
}
}
That’s to redirect to main URl(https://myserver.domian) after judging if access **/ui/login and without token and authentication info, and access to the main URL will redirect to the SSO login page and directly access the artifactory.