Skip to content

Troubleshooting

Troubleshooting the HTTP Servers

Please Note: In the sections below, if you are using any instance name other than default for MDRest4i, MDRST should be replaced with MDRSTxxxx where, xxxx is the instance name

If the SDK web UI wont load, or an API wont respond, it may be caused by a server configuration problem.

Please check the following areas.

Is the Server Running

Use the following command to see if the server jobs are started:

WRKACTJOB SBS(QHTTPSVR) JOB(MDRST)

where "MDRST" is the library where MDrest4i MDRFRAME is installed.

If it isn't running, use the following command to start the server

STRTCPSVR SERVER(*HTTP) HTTPSVR(MDRST)

Then check to see if the jobs are active. If they are test the web ui again

SDK Server config - httpd.conf

If the server wont start of you cannot connect it may be the server configuration.

View the HTTP config file here: /www/mdrst/conf/httpd.conf file (either from the HTTPAdmin console or the IFS in 5250 screens/VSCode). It should look like this:

# MDRest4i: Created by MDRHTTPSDK on 2024-02-28-16.43.16
Listen *:2519
DocumentRoot /www/mdrst/htdocs
TraceEnable Off
LogFormat "%h %T %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{Cookie}n \"%r\" %t" cookie
LogFormat "%{User-agent}i" agent
LogFormat "%{Referer}i -> %U" referer
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log combined
LogMaint logs/access_log 30 0
LogMaint logs/error_log 30 0
SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0
<Directory />
 Require all denied
</Directory>
<Directory /www/mdrst/htdocs>
  Require all denied
</Directory>

### MDRest4i: Config Start
HTTPStartJobDesc mdrst/mdrst
SetEnv QIBM_CGI_CHANGE_CURDIR N
SetEnv QIBM_CGI_CHANGE_CURLIB N
## MDREST4i: The line below allows authorization tokens to be passed through to the CGI program
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

## MDRest4i: CORS header settings
Header Set Access-Control-Allow-Origin "*"
Header Set Access-Control-Allow-Headers "AUTHORIZATION,ORIGIN,CONTENT-TYPE,ACCEPT"
Header set Access-Control-Allow-Methods "POST,GET,OPTIONS,DELETE,PUT"

## MDRest4i: API Script Alias Settings
ScriptAliasMatch mdrsdk /QSYS.LIB/mdrst.LIB/MDRSDK.PGM
ScriptAliasMatch mdrapi /QSYS.LIB/mdrst.LIB/MDRAPI.PGM

## MDRest4i: SDK WEB UI Alias Settings
AliasMatch /wiki/(.*) /www/mdrst/wiki/$1
AliasMatch /cons/(.*) /www/mdrst/cons/$1
AliasMatch /docu/(.*) /www/mdrst/docu/$1

## MDRest4i: REST API Library
<Directory /QSYS.LIB/mdrst.LIB>
 Require all granted
 SetEnv MDREST4I_RESOURCE_COMPONENT 3
 SetEnv MDREST4I_SDK_CONFIG_PATH "/www/mdrst/cons/mdrsdk_Templates.json"
 SetEnv MDREST4I_SDK_INITIALIZE_DEFAULTS *NO
 DefaultNetCCSID 1208
 CgiConvMode binary
 ServerUserID mdowner
</Directory>

## MDRest4i: Console Config
<Directory /www/mdrst/cons>
 <FilesMatch "index.html|startup.json|build.json">
  FileEtag None
  Header Unset ETag
  Header Set Cache-Control "max-age=0, no-store, no-cache, must-revalidate"
  Header Set Pragma "no-cache"
  Header Set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
 </FilesMatch>
 Header set Access-Control-Allow-Origin "*"
 Options +FollowSymLinks -MultiViews
 DirectoryIndex index.html
 RewriteEngine On
 RewriteRule mdrconsoleapp_(.*)\.js mdrconsoleapp.js
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule artefacts/TokenManager/tokenapp_(.*)\.js artefacts/TokenManager/tokenapp.js
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.html [QSA,L]
 Require all granted
 ServerUserID mdowner
</Directory>

## MDRest4i: Documenter Config
<Directory /www/mdrst/docu>
 <FilesMatch "index.html|startup.json|build.json">
  FileEtag None
  Header Unset ETag
  Header Set Cache-Control "max-age=0, no-store, no-cache, must-revalidate"
  Header Set Pragma "no-cache"
  Header Set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
 </FilesMatch>
 Header set Access-Control-Allow-Origin "*"
 Options FollowSymLinks MultiViews
 DirectoryIndex index.html
 RewriteEngine On
 RewriteRule mdrdocumenterapp_(.*)\.js mdrdocumenterapp.js
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.html [QSA,L]
 Require all granted
 ServerUserID mdowner
</Directory>

## MDRest4i: Wiki Docs
<Directory /www/mdrst/wiki>
 Require all granted
 ServerUserID mdowner
</Directory>
### MDRest4i: Config End

HTTP Server logs

Navigate to /www/mdrst/logs and view the contents of the error and/or access logs.

Spool Files for the Server Job

If there is a crash or server startup problem, it may generate a spool file which can be found here:

WRKSPLF SELECT(QTMHHTTP *ALL *ALL MDRSTT14)

HTTP Server Job Description

In the httpd.conf configuration file there is a directive: HTTPStartJobDesc mdrst/mdrst

Look at the library list part of this job description, to ensure that MDRST (or the library name MDRSTxxx consistent with the instance installed) is in the library list of this JOBD. DSPJOBD JOBD(MDRST/MDRST)