CGI Context
Table of Contents
URI | Path | Header Operations | Allow Set UID | Realm | Authentication Name | Require (Authorized Users/Groups) | Access Allowed | Access Denied | Authorizer | Add Default Charset | Customized Default Charset | Enable Rewrite | Rewrite Inherit | Rewrite Base | Rewrite Rules | Enable GeoLocation Lookup
CGI Context⇑
Description
A CGI context defines scripts in a particular directory as CGI scripts. This directory can be inside or outside of the document root. When a file under this directory is requested, the server will always try to execute it as a CGI script, no matter if it's executable or not. In this way, file content under a CGI Context is always protected and cannot be read as static content. It is recommended that you put all your CGI scripts in a directory and set up a CGI Context to access them.
URI⇑
Description
Specifies the URI for this context.
Syntax
The URI can be a plain URI (starting with "/") or a Perl compatible regular expression URI (starting with "exp:"). If a plain URI ends with a "/", then this context will include all sub-URIs under this URI. If the context maps to a directory on the file system, a trailing "/" must be added.
See Also
Path⇑
Description
Specifies the location of CGI scripts.
Syntax
The path can be a directory that contains a group of CGI scripts, like $VH_ROOT/myapp/cgi-bin/. In this case, the context URI must end with "/", like /app1/cgi/. The Path can also specify only one CGI script, like $VH_ROOT/myapp/myscript.pl. This script should have the corresponding URI /myapp/myscript.pl.
Header Operations⇑
Description
Specifies additional response/request headers to be added. Multiple header directives can be added with one directive per line. "NONE" can be used to disable parent header inheritance. If no directive is provided 'Header' is assumed.
Syntax
[Header]|RequestHeader [condition] set|append|merge|add|unset header [value] [early|env=[!]variable]
Example
append Cache-control no-store
Header set My-header cust_header_val
RequestHeader set My-req-header cust_req_header_val
Tips
Syntax and usage are similar to Apache's mod_headers directives for supported operations.
The 'Header' directive is is optional and can be excluded or left in when copying rules from elsewhere without issue.
Allow Set UID⇑
Description
Specifies whether the set UID bit is allowed for CGI scripts. If the set UID bit is allowed and the set UID bit is enabled for a CGI script, no matter which user the CGI script was started on behalf of, the user ID of the CGI process will switch to the user ID of the owner of the CGI script.
The default is "Off".
Syntax
Select from radio box
Tips
Do not allow Set UID CGI scripts whenever possible, as it is inherently a security risk.
Realm⇑
Description
Specifies the authorization realm for this context. When specified, a valid username and password must be provided in order to access this context. Authorization Realms are set up in the Virtual Host Security section. This setting uses each realm's Realm Name.
Syntax
Select from drop down list
Authentication Name⇑
Description
Specifies an alternative name for the authorization realm for the current context. If not specified, the original realm name will be used. The authentication name is displayed on the browser's login pop-up.
Require (Authorized Users/Groups)⇑
Description
Specifies which user/group can access this context. This allows you to use one user/group database (specified in Realm) across a number of contexts, but only allow certain users/groups from that database to access this context.
Syntax
Syntax is compatible with Apache's Require directive. For example:
- user username [username ...]
Only listed users can access this context. - group groupid [groupid ...]
Only users belonging to the listed groups can access this context.
Access Allowed⇑
Description
Specifies which IPs or sub-networks are allowed to access resources under this context. Together with Access Denied and server/virtual host level access control, accessibility is determined by the smallest scope that a client's IP address falls into.
Syntax
Comma-delimited list of IPs/sub-networks.
Example
Access Denied⇑
Description
Specifies which IPs or sub-networks are NOT allowed to access resources under this context. Together with Access Allowed and server/virtual host-level access control, accessibility is determined by the smallest scope that a client's IP address falls into.
Syntax
Comma-delimited list of IPs/sub-networks.
Example
Authorizer⇑
Description
Specifies an external application that can be used to generate authorized/unauthorized decisions. Currently, only the FastCGI Authorizer is available. For more details about the FastCGI Authorizer role, please visit http://www.fastcgi.com.
Syntax
Select from drop down list
Add Default Charset⇑
Description
Specifies whether to add a character set tag to the "Content-Type" response header, when content type is either "text/html" or "text/plain" without any parameters. When set to Off, this function is disabled. When set to On, either the character set specified by Customized Default Charset or the default "iso-8859-1" will be added.
Syntax
Select from radio box
Customized Default Charset⇑
Description
Specifies a character set to be used when Add Default Charset is On. This is optional. The default value is iso-8859-1. This entry has no effect when Add Default Charset is Off.
Syntax
Name of a character set.
Example
Enable Rewrite⇑
Description
Specifies whether to enable LiteSpeed's URL rewrite engine. This option can be customized at the virtual host or context level, and is inherited along the directory tree until it is explicitly overridden.
Syntax
Select from radio box
Rewrite Inherit⇑
Description
Specifies whether to inherit rewrite rules from parent contexts. If rewrite is enabled and not inherited, rewrite base and rewrite rules defined in this context will be used.
Syntax
Select from radio box
Rewrite Base⇑
Description
Specifies the base URL for rewrite rules.
Syntax
URL
Rewrite Rules⇑
Description
Specifies a list of rewrite rules at the virtual host level.
Do NOT add any document root level rewrite rules here. If you have any document root level rewrite rules from .htaccess, you should instead create a static context with uri "/" and add the rewrite rules there.
A rewrite rule is comprised of one RewriteRule directive and optionally preceded by multiple RewriteCond directives.
- Each directive should take only one line.
- RewriteCond and RewriteRule follow Apache's rewrite directive syntax. Just copy and paste rewrite directives from your Apache configuration files.
- There are minor differences between LiteSpeed and Apache mod_rewrite implementation:
- %\{LA-U:variable\} and %\{LA-F:variable\} are ignored by the LiteSpeed rewrite engine
- Two new server variables are added in the LiteSpeed rewrite engine: %\{CURRENT_URI\} represents the current URI being processed by the rewrite engine and %\{SCRIPT_NAME\} has the same meaning as the corresponding CGI environment variable.
- The LiteSpeed rewrite engine will stop processing rewrite rules after encountering an [L] flag to avoid looping while Apache mod_rewrite will stop processing rewrite rules for the current iteration only. This behavior is similar to that of the [END] flag in Apache mod_rewrite.
The implementation of LiteSpeed's rewrite engine follows Apache's rewrite engine specifications. For more details about rewrite rules, please refer to Apache's mod_rewrite document and Apache's URL rewriting guide .
Syntax
string
Enable GeoLocation Lookup⇑
Description
Specifies whether to enable/disable IP Geolocation lookup. Can be set at server, virtual host, or context level. IP Geolocation is disabled by default when using value "Not Set".
Syntax
Select from radio box