Summary:
The customer requested support for having unique domain names for each portal. For example, it.acme.com, hr.acme.com, and facility.acme.com.
As a workaround, portal-specific custom domains are being achieved using an NGINX server without requiring any application code changes.
Workaround Implementation Details:
The NGINX server validates the PORTALID cookie for routing purposes.
After a successful login, users are automatically redirected to the appropriate portal based on the domain, if they have the necessary access permissions.
When users switch between portals, the corresponding domain for the new PORTALID is identified in nginx server, and the user is redirected to that domain (re-authentication may be required in some cases).
Pre-requisites for Enabling Portal-Specific Domains using NGinx server:
Alias URLs for all portals (including the IT portal) must be configured under ESM Directory → ServiceDesk Instance.
The Default Landing Portal must be disabled.
NGINX supports only PEM format SSL certificates (.crt, .key files).
Based on the customer’s requirements, this step may vary.
(i). If the customer wants to use portal-specific domains, each portal must have a unique domain name. For example, hr.acme.com, it.acme.com, facility.acme.com, and blank.acme.com should each represent a different portal, and all these domains should point to a single NGINX server.
or
(ii). If the customer has only two portals (IT and Facility) and wants to host the Facility portal publicly while keeping the IT portal accessible only through the internal network, the customer can configure the Facility domain certificate on NGINX, while the IT domain certificate can be configured for the internal network.
After build 15200, NGINX is bundled with our product. You can either use the bundled NGINX or download the latest stable version from the link below: http://nginx.org/en/download.html
Extract the downloaded zip file.
After extracting the zip file, Open the nginx.conf file which is available under "nginx/conf/" directory.
Replace/create the whole nginx.conf file with the uploaded (PFA) configuration file nginx_esm_urls.conf (The file name must be "nginx.conf" under nginx/conf).
Refer to the below configurations to configure the NGinx server's port and Nginx domain url name
server {
# Below to change the nginx server's port
listen 443 ssl;
# server name is nginx domain name
server_name ~^(.*)\.abc\.com$;
Refer to the below configurations to update ServiceDesk plus app server details.
Replace https://127.0.0.1:8080; to your SDP Server IP and port.
#need to update with the sdp server with ip address
map $find_portalid $target_backend {
default https://127.0.0.1:8080; #SDP Server URL
Refer to the below configuration to apply the SSL certificates. In Nginx, the SSL/TLS certificate files must be in PEM format(Privacy Enhanced Mail). Create ssl folder under nginx/conf folder and paste your .crt and .key file inside this ssl folder..
#Rename with your .crt and .key file
ssl_certificate ssl/server.crt;
ssl_certificate_key ssl/server.key;Getting instance details using these below queries
Getting instance details using these below queries:
query: select helpdeskid,alias_url from HelpDeskAdditionalInfo;
INSTANCE NAME
PORTAL ID
ALAIS URL
INSTANCE DOMAIN
IT Helpdesk
1
/portal/it
it.zylker.com
HR
301
/portal/hr
hr.zylker.com
Facility
302
/portal/facility
facility.zylker.com
Blank
601
/portal/blank
blank.zylker.com
Note: For alais url, /portal/ is default prefix value.The below all sample map configurations are need to update with your domain configuration values.
map $from_portalid $target_host {
"301" hr.acme.com;
"302" facility.acme.com;
default it.acme.com; #default IT portal
}
map $from_portalid $redirect_host {
"301" https://hr.acme.com; # hr.servicedesk.com
"302" https://facility.acme.com;
default http://it.acme.com; #default IT Portal
}
map $host $find_portalid {
"hr.acme.com" 301;
"facility.acme.com" "302";
default "1"; #default IT portal
}
map $host $find_portalapi {
"hr.acme.com" "/portal/hr";
"facility.acme.com" "/portal/facility";
default "/portal/it"; #default IT portal
}
map final_portalid $find_changeportal {
"301" "/portal/hr";
"302" "/portal/facility";
default "/portal/it"; #default IT portal
}
map $from_portalid $target_host {
"301" hr.zylker.com;
"302" facility.zylker.com;
"601" blank.zylker.com;
default it.zylker.com; #default IT portal
}
map $from_portalid $redirect_host {
"301" https://hr.zylker.com; # hr.servicedesk.com
"302" https://facility.zylker.com;
"601" https://blank.zylker.com;
default http://it.zylker.com; #default IT Portal
}
map $host $find_portalid {
"hr.zylker.com" 301;
"facility.zylker.com" "302";
"blank.zylker.com" 601;
default "1"; #default IT portal
}
map $host $find_portalapi {
"hr.zylker.com" "/portal/hr";
"facility.zylker.com" "/portal/facility";
"blank.zylker.com" "/portal/blank";
default "/portal/it"; #default IT portal
}
map final_portalid $find_changeportal {
"301" "/portal/hr";
"302" "/portal/facility";
"601" "/portal/blank";
default "/portal/it"; #default IT portal
}
5. For testing nginx configuration, execute the below command in Nginx server installed directory in cmd prompt.
- command for testing nginx : nginx.exe -t
6. Start the NGinx Server by using below commands.For windows, Open the command prompt, under the NGinx server installed directory and execute the below command.Command for start nginx server: start nginx.exe (or) start nginx
Command for Stop Nginx server: nginx.exe -s stop