How to assign/associate custom domain for ESM instance?

How to assign/associate custom domain for ESM instance?

Workaround Solution for Portal-Specific Custom Domains

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:

  1. Alias URLs for all portals (including the IT portal) must be configured under ESM Directory → ServiceDesk Instance.

  2. The Default Landing Portal must be disabled.

  3. NGINX supports only PEM format SSL certificates (.crt, .key files).

  4. 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.


Steps to achieve portal specific custom domain using nginx server:

  1. If servicedesk plus server is runs on HTTPS mode, then NGinx also will run on HTTPS Mode (It is mandatory).
  2. 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 

  3. Extract the downloaded zip file.

  4. After extracting the zip file, Open the nginx.conf file which is available under "nginx/conf/" directory.

  5. 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).

  6. MODIFY below nginx configuration with servicedesk-plus server details
    1. Refer to the below configurations to configure the NGinx server's port and Nginx domain url name 

    2.  

        server {

            # Below to change the nginx server's port

              listen      443 ssl;

           # server name is nginx domain name

      server_name ~^(.*)\.abc\.com$;

    3. 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

       

    4. Nginx supports only PEM-format certificates (.crt and .key files).

      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..

    5.     

           #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
    6. Getting instance details using these below queries:

                         query: select helpdeskid,alias_url from HelpDeskAdditionalInfo;


                        For example, 

 

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

}


                              For above sample content, you need to update all portal id values, alais url, domain names for all the portals.
                              
                              For understanding purpose, we give an sample content with 4 portals and their details are
                                          portal ids -> it  - 1, hr - 301, facility - 302, blank - 601
                                          alais url -> it - /portal/it , hr - /portal/hr , facility - /portal/facility , blank - /portal/blank
                                          domain names -> it - it.zylker.com , hr - hr.zylker.com, facility - facility.zylker.com , blank - blank.zylker.com
                              
                              A new configuration with above sample details
                              

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.
    1. 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