Which link do you prefer: http://mydomain.com:8000/company/appname OR http://mydomain.com?

Do you want your SAP HANA XS Application to run on standard HTTP and/or HTTPS ports (80, 443 respectively), not only for simplicity, but to avoid firewall issues? If yes, see Section 1 below. Would you also like to allow users to invoke your XS application just by typing a domain name (e.g. mydomain.com) without your package path? If yes, see Section 2 below.

Note: These steps were performed on SAP HANA rev 67. These steps are NOT recommended for HANA One instances. For HANA One it is recommended to use Elastic Load Balancing IP addresses to achieve the similar goals (not covered here).

SECTION 1: Use a standard port for your web app (Estimated time 10 minutes)

Process Overview

Prerequisite:        Make sure you have the right credentials and that your XS app already works

Step 1:                   Ensure your target port is available

Step 2:                   Modify web dispatcher profile

Step 3:                   Enable binding of your XS port to the new listening port

Step 4:                   Restart your server or webdispatcher

Step 5:                   Test your app

Troubleshooting

Prerequisite: Make sure you have the right credentials and that your XS app already works

Note: Super-user permissions are required to bind the XS server to a port below 1024. Do not begin this process if you cannot perform commands as a super user such as root.

Make sure your XS app is already working properly on a typical XS port such as 80<instance_ nbr> where <instance_nbr> is your HANA instance number (e.g. 8000 for instance number 00). If you already have SSL working your default port is 43<instance_nbr> (e.g. 4300 for instance number 00).

If you want to use port 443 make sure you already have your application supporting SSL. Here is an SSL guide that may be helpful for you.

Step 1: Ensure your target port is available

Make sure your target port is not already occupied (for the remainder of this post I will use port 80 as the target port. Just substitute “80” with “443” if you want to use the standard HTTPS port).

Connect to your shell using an ssh tool (such as putty) using your HANA administrator ID: <sid>adm where <sid> is replaced with your HANA instance name (e.g. hdbadm)

Type the following from the linux command line:

netstat -a | grep http        

If you see something returned for your target port (http or https) such as below for http, then something is already running on that port and you should STOP! Do not proceed until you determine what it is, shut it down, and remove it from start scripts, if appropriate.

img1.png

If nothing is returned as shown below, then you are safe to continue to the next step!

               img2.png

Step 2:   Modify web dispatcher profile

Edit the following file: /usr/sap/<SID>/HDB<instance_nbr>/<hostname>/wdisp/sapwebdisp.pfl

For example:

vi /usr/sap/HDB/HDB00/hanaserver/wdisp/sapwebdisp.pfl

Comment out one or both of the following two lines using the # symbol

#icm/server_port_0 = PROT=HTTP,PORT=$(_HTTP_PORT),PROCTIMEOUT=600

#icm/server_port_1 = PROT=HTTPS,PORT=$(_HTTPS_PORT),PROCTIMEOUT=600

Add both or one of the following two lines

icm/server_port_0 = PROT=HTTP,PORT=80,EXTBIND=1,PROCTIMEOUT=600

icm/server_port_1 = PROT=HTTPS,PORT=443,EXTBIND=1,PROCTIMEOUT=600

Step 3:   Enable binding of your XS port to the new listening port

Note: This step requires superuser permissions and needs to be done by a super user such as root.

Change to the following folder: /usr/sap/<sid>/HDB<instance_nbr>/exe/ substituting your info in the brackets as shown below:

cd /usr/sap/HDB/HDB00/exe/

copy icmbnd.new to icmbnd

cp icmbnd.new icmbnd

Change the owner of the icmbnd command

chown root:sapsys icmbnd

Change the permissions for the icmbnd command:

chmod 4750 icmbnd

Check the new permissions for the icmbnd command:

ls –al

The result should look like the following:

rwsr-x 1 root sapsys 1048044 Feb 13 16:19 icmbnd

Step 4:   Restart your HANA server or webdispatcher

To keep it simple, restart your HANA Server logged in using your HANA admin user <sid>adm:

HDB stop

HDB start

Alternatively, you can just restart your web dispatcher by following the steps outlined in section 3 of this post. Then return to Step 5 below.

Step 5:   Test your app

From a browser, try testing your application using the same url but with the new port number (or without any port number).

Troubleshooting

Check the following web dispatcher trace file for errors: /usr/sap/<SID>/HDB<instance_nbr>/<hostname>/trace/dev_webdisp

vi /usr/sap/HDB/HDB00/hanaserver/trace/dev_webdisp

SECTION 2: Avoid typing the XS package name to invoke your site URL (Estimated time 5 minutes)

This section explains how to redirect requests made to the root of your domain, to your preferred SAP HANA XS package path (e.g. http://mydomain.com will redirect the user to http://mydomain.com/company/package).

Process Overview

Step 1:                   Modify web dispatcher profile

Step 2:                   Restart your server or web dispatcher

Step 3:                   Test your app

Step 1:   Modify web dispatcher profile

Edit the following file: /usr/sap/<SID>/HDB<instance_nbr>/<hostname>/wdisp/sapwebdisp.pfl

vi /usr/sap/HDB/HDB00/hanaserver/wdisp/sapwebdisp.pfl

Add the following line, substituting the information in brackets:

icm/HTTP/redirect_0 = PREFIX=/, FROM=/, TO=</company/package/>, PROT=HTTP, HOST=<mydomain.com>, PORT=80

To support the example presented in the beginning of this section, you would add the following line:

icm/HTTP/redirect_0 = PREFIX=/, FROM=/, TO=/company/package/, PROT=HTTP, HOST=mydomain.com, PORT=80

Step 2: Restart your HANA server or web dispatcher

To keep it simple, restart your HANA Server logged in using your HANA admin user <sid>adm:

HDB stop

HDB start

Alternatively, you can just restart your web dispatcher by following the steps outlined in section 3 of this post. Then return to Step 3 below.

Step 3: Test your new URL

From a browser, invoke your URL without any path. You should be redirected to your full URL.

Troubleshooting

Check the following web dispatcher trace file for errors: /usr/sap/<SID>/HDB<instance_nbr>/<hostname>/trace/dev_webdisp

vi /usr/sap/HDB/HDB00/hanaserver/trace/dev_webdisp

SECTION 3 (Optional): Restart your web dispatcher without restarting the entire HANA server

Follow these steps to restart your web dispatcher, only if you chose not to restart your HANA server as shown in the previous sections.

Retrieve the process ID for the webdisp_hdb server:

ps -ef | grep <sid>adm

Send a signal 2 to the service to restart it. See command and image below.

sapcontrol -nr <instance_nr> -function SendSignal <process_id> 2

img3.png

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Paul Aschmann

    Hi Mark, thanks for sharing this info – very useful!

    For reference here is one which I used frequently to do something similar and run my web app on 80:

    sudo iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT –to-ports 8000

    Another interesting one is that if you want the “default” XS (Splash page) page to redirect to one of your subsites you can create a new xsengine.ini parameter:

    [httpserver] root_page = /my/fancy/welcome.html


    Cheers, Paul

    (0) 

Leave a Reply