APPENDIX 1A - HTTP directives

 

HTTP directives are installed in two separate iWEB installation steps: Converter installation and Runtime installation.

Depending on OS/400 release, two different HTTP servers are available:

  • The so called Original HTTP Server, the one OS/400 was originally equipped with. It is supported up to and including OS/400 release V5R2. It is no longer supported from OS/400 release V5R3 on.
  • The HTTP Server powered by Apache, supported since OS/400 release V5R1 (however we suggest to start using Apache from V5R2 on)

In our opinion, the directives of HTTP server powered by Apache are much more difficult than those used in the Original HTTP server. Therefore, if you have no experience yet with the iSeries HTTP servers, and your iSeries OS/400 release is not yet V5R2, we suggest you start with the Original HTTP server. However, when you reach release V5R2, you have better to switch to Apache in order to have eveything properly set up when you must switch to V5R3, where the Original HTTP server is no longer supported.

A few words about wizards.
iSeries HTTP server is shipped with a built-in HTTP instance named *ADMIN. This HTTP instance works with port number 2001. IBM suggests its use for creating and maintaining customer HTTP instances. We believe that if you are a novice with HTTP you should not use wizards, if you don't want to end up the way young sorcerers do. We suggest that you start doing your best to understand how HTTP directives (Original and Apache) work. See our bibliography.

The following describes how HTTP instances work in iSeries.

File QATMHINSTC in library QUSRSYS contains a member for each available HTTP instance.
This is the file that is accessed when you start all autostart HTTP instances [command STRTCPSVR SERVER(*HTTP) HTTPSVR(*ALL)] or when you start a single HTTP instance [command STRTCPSVR SERVER(*HTTP) HTTPSVR(instance_name)].
Each member in this file contains a single control record which tells:

  • the type of HTTP instance (Original orApache)
  • whether the instance should be autostarted or not
  • where the HTTP directives of the instance are located.
Here are some examples of such control records from two different members of file QUSRSYS/QATMHINSTC:
  1. -r /QSYS.LIB/QUSRSYS.LIB/QATMHTTPC.FILE/IWEBCVT.MBR -AutoStartY
  2. -apache -d /iwebdata/http -f conf/IWEBRUNAPA.conf -AutoStartY
Control record 1 tells that this HTTP instance (the one with the same name as name of the member containing this record) is type Original ("-r"), is autostarted, and that its directives are in member IWEBCVT of file QUSRSYS/QATMHTTPC.
Control record 2 tells that this other HTTP instance is type Apache ("-apache"), is autostarted, and that its directives are in the IFS stream file /iwebdata/http/conf/iwebrunapa.conf .

Let us now have a look at the directives of the first HTTP instance.
This is an Original HTTP instance named IWEBCVT.
This HTTP instance is automatically generated when you install the iWEB Converter and your OS/400 release is before V5R3 (on V5R3 or subsequent, an Apache HTTP instance named IWEBCVT would be generated instead).
As this is an Original HTTP instance, you can maintain it with command WRKHTTPCFG CFG(IWEBCVT) .
Let us have a look to its directives.  
 
0001.00 #==== Start of iWEB Converter ===========================#      
0002.00 Protection OSUsrprfs {
0003.00 PasswdFile %%SYSTEM%%
0004.00 ACLOverride Off
0005.00 PostMask All
0006.00 GetMask All 
0007.00 AuthType Basic 
0008.00 ServerID "iWEB Converter" 
0009.00 UserID %%CLIENT%% 
0010.00 }
0011.00 Protect /iwebp/* OSUsrprfs
0012.00 Map  /iwebh/*.htm  /iwebh/*.mbr 
0013.00 Map  /iwebp/*.cgi  /iwebp/*.pgm
0014.00 Map  /iwebh/* /QSYS.LIB/IWEB.LIB/HTMLSRC.FILE/*
0015.00 Pass /QSYS.LIB/IWEB.LIB/HTMLSRC.FILE/*
0016.00 Pass /iweb/*
0017.00 Pass /iwebdata/* 
0018.00 Exec /iwebp/* /QSYS.LIB/IWEB.LIB/*  %%EBCDIC%%
0019.00 #==== End   of iWEB Converter ===========================#
0020.00  
0021.00 Port               8008 
0023.00 BindSpecific Off 
0024.00 enable get 
0025.00 enable post  
0026.00 Disable CONNECT 
0027.00 Disable DELETE 
0028.00 Disable HEAD 
0029.00 Disable OPTIONS  
0030.00 Disable PUT 
0031.00 Disable TRACE  
0032.00  
0033.00 DirAccess          Off  
0034.00  
0035.00 AlwaysWelcome      On 
0036.00 Welcome            Welcome.html  
0037.00 Welcome            Welcome.htm  
0038.00 Welcome            welcome.htm  
0039.00 Map /* /iweb/*  
0040.00 Pass  /iweb/*  
0041.00   
0042.00 AddType .exe application/exe binary  1.0  
0043.00 AddType .EXE application/EXE binary  1.0  
0044.00 AddType .js application/x-javascript 8bit 
0045.00 AddType .JS application/x-javascript 8bit 
0046.00 AddType .gif image/gif 8bit 
0047.00 AddType .css text/css 8bit 1.0 
0048.00                                
0049.00 InputTimeOut   2 mins  
0050.00 OutputTimeOut 60 mins  
0051.00 ScriptTimeOut 60 mins  
Figure 1A-01 iWEB Converter Original HTTP instance
Some remarks:

  • directive 21 tells that this HTTP instance is available on port 8008
  • directives 35 to 40 tell that the welcome page is the IFS stream file /iweb/welcome.html
  • directives 2 to 11 tell that in order to execute the Converter the user must logon with an existing user profile and password
  • directives 12 to 14 provide the translations for some path aliases used in many Converter HTML pages
  • directives 15 to 17 allow access to some IFS directories and to library IWEB
  • directive 18 allows execution of CGI programs in library IWEB

Let us now move to the second HTTP instance.
It is an Apache HTTP instance named IWEBRUNAPA.
This HTTP instance was generated by the IWEB Runtime installation procedure. The user performing the installation decided for an Apache HTTP instance, to be named IWEBRUNAPA, and to be active on port 8010.
As this is an Apache HTTP instance, you can maintain it with command EDTF STMF('/iwebdata/http/conf/iwebrunapa.conf') .
 
 
0001.00 #=========================================================================                 
0002.00 # APACHE HTTP instance for iWEB Runtime                                                    
0003.00 #========================================================================= 
0004.00 #----        General directives 
0005.00 ServerRoot /iwebdata/http/  
0006.00 DocumentRoot /iwebdata/http/htdocs   
0007.00 Listen  8010  
0008.00 ThreadsPerChild      53                          
0009.00 MaxCGIJobs           100  
0010.00 TimeOut 120  
0011.00 AlwaysDirectoryIndex off  
0012.00 Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch -Includes -Indexes -MultiViews      
0013.00 #UseCanonicalName Off 
0014.00 SetEnvIf User-Agent "Mozilla/2" nokeepalive 
0015.00 SetEnvIf User-Agent "JDK/1\.0" force-response-1.0  
0016.00 SetEnvIf User-Agent "Java/1\.0" force-response-1.0  
0017.00 SetEnvIf User-Agent "RealPlayer 4\.0" force-response-1.0   
0018.00 SetEnvIf User-Agent "MSIE 4\.0b2;" nokeepalive  
0019.00 SetEnvIf User-Agent "MSIE 4\.0b2;" force-response-1.0   
0020.00 #----        Performance   
0021.00 LoadModule deflate_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM  
0022.00 AddOutputFilter DEFLATE text/html   
0023.00 StartCGI 4 QTMHHTP1
0024.00 CgiInitialUrl /qsys.lib/iweb.lib/runtime.pgm  QTMHHTP1  
0025.00 #----        iWEB Runtime directives  
0026.00 #The next directive defines the home page   
0027.00 AliasMatch ^/$               /iwebdata/index.html  
0028.00 AliasMatch /iwebh/(.*)\.htm  /QSYS.LIB/IWEB.LIB/HTMLSRC.FILE/$1.mbr  
0029.00 Alias /iweb/       /iweb/  
0030.00 Alias /iwebdir/       /iwebdir/  
0031.00 Alias /iwebdata/   /iwebdata/   
0032.00 Alias /iwebrun     /iwebdata/index.html  
0033.00 Alias /iWeb.jar    /iwebdata/iWeb.jar  
0034.00 ScriptAliasMatch ^/iexplore$     /qsys.lib/iweb.lib/iexplore.pgm  
0035.00 ScriptAliasMatch /iwebp/(.*).pgm /qsys.lib/iweb.lib/$1.pgm  
0036.00 ScriptAliasMatch /iwebp/(.*).cgi /qsys.lib/iweb.lib/$1.pgm  
0037.00 <Directory /iweb>  
0038.00    AddOutputFilter INCLUDES .shtml  
0039.00    AllowOverride None  
0040.00    Options None  
0041.00    order allow,deny  
0042.00    allow from all 
0043.00 </Directory>  
0044.00 <Directory /iwebdir> 
0045.00    AllowOverride None 
0046.00    Options None 
0047.00    order allow,deny  
0048.00    allow from all 
0049.00 </Directory>  
0050.00 <Directory /iwebdata>  
0051.00    AllowOverride None  
0052.00    Options None  
0053.00    order allow,deny  
0054.00    allow from all  
0055.00 </Directory>  
0056.00 <Directory /QSYS.LIB/IWEB.LIB>  
0057.00    AllowOverride None  
0058.00    Options None  
0059.00    order allow,deny  
0060.00    allow from all    
0061.00    CGIConvMode %%EBCDIC/EBCDIC%%  
0062.00 </Directory>  
0063.00 <LocationMatch (^/iwebp(.*)$|^/iexplore$)>  
0064.00    AuthType Basic   
0065.00    AuthName "iWEB"  
0066.00    PasswdFile %%SYSTEM%%  
0067.00    UserID %%CLIENT%%  
0068.00    Require valid-user  
0069.00 </LocationMatch> 
Figure 1A-02 iWEB Runtime Apache HTTP instance
Remarks:

  • directive 7 tells that this HTTP instance is available from port 8010
  • directive 27 identifies the (home) welcome page
  • directive 28 provides translation for a path alias
  • directives 29 to 33 identify IFS paths
  • directives 34 to 36 (together with directives 12 and 61) allow execution of CGI programs
  • directives 37 to 43 allow access to IFS directory /iweb
  • directives 44 to 49 allow access to IFS directory /iwebdir
  • directives 50 to 55 allow access to IFS directory /iwebdata
  • directives 56 to 62 allow access to library IWEB
  • directives 63 to 69 tell that in order to execute the Runtime the user must logon with an existing user profile and password