| Server IP : 202.155.9.250 / Your IP : 216.73.217.178 Web Server : LiteSpeed System : Linux srv339029361 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64 User : bigas1846 ( 1044) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/local/lsws/docs/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>OpenLiteSpeed Users' Manual - Servlet Context</title>
<meta name="description" content="OpenLiteSpeed Users' Manual - Servlet Context." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex">
<script>
(function () {
var theme = 'light';
var resolved = false;
try {
if (window.localStorage) {
var storedTheme = window.localStorage.getItem('hdoc.theme');
if (storedTheme === 'light' || storedTheme === 'dark') {
theme = storedTheme;
resolved = true;
}
}
} catch (err) {
}
if (!resolved && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
}
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme;
}());
</script>
<link rel="shortcut icon" href="img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/hdoc.css">
<link rel="stylesheet" type="text/css" href="css/hdoc-product-accent.css">
<script src="hdoc-search-index.js" defer></script>
<script src="js/hdoc-search.js" defer></script>
</head>
<body>
<div class="doc-shell">
<header class="doc-topbar">
<a class="doc-brand" href="index.html" aria-label="OpenLiteSpeed Users' Manual">
<img src="img/ols_logo.svg" alt="OpenLiteSpeed logo" />
<strong>OpenLiteSpeed Users' Manual</strong>
</a>
<div class="doc-actions">
<button class="doc-menu-toggle" type="button" aria-label="Open menu" data-menu-toggle aria-expanded="false">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 12h18M3 6h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
</button>
<form class="doc-search" role="search" data-empty="Search pages and settings" data-no-results="No results found.">
<label class="sr-only" for="doc-search-input">Search the manual</label>
<div class="doc-search__box">
<input id="doc-search-input" type="search" autocomplete="off" placeholder="Search pages and settings" aria-controls="doc-search-results" />
<button type="submit">Search</button>
</div>
<div id="doc-search-results" class="doc-search__results" hidden></div>
</form>
</div>
<label class="doc-language"><select id="doc-language-switcher" name="doc_language" data-language-switcher aria-label="Language"><option value="Servlet_Context.html" data-lang="en-US" selected>English</option><option value="es-ES/Servlet_Context.html" data-lang="es-ES">Español</option><option value="de-DE/Servlet_Context.html" data-lang="de-DE">Deutsch</option><option value="fr-FR/Servlet_Context.html" data-lang="fr-FR">Français</option><option value="zh-CN/Servlet_Context.html" data-lang="zh-CN">简体中文</option><option value="ja-JP/Servlet_Context.html" data-lang="ja-JP">日本語</option></select></label>
<button class="doc-theme-toggle" type="button" aria-label="Toggle theme" data-theme-toggle data-theme-light-label="Light mode" data-theme-dark-label="Dark mode" title="Toggle theme">
<span class="doc-theme-toggle__icon" aria-hidden="true"></span>
</button>
</header>
<div class="doc-menu-backdrop" data-menu-backdrop></div>
<div class="pagewrapper" data-current-lang="en-US" data-supported-langs="["en-US","es-ES","de-DE","fr-FR","zh-CN","ja-JP"]"><aside class="sidetree"><div class="sidetree__masthead"><figure class="sidetree__figure"><img src="img/ols_logo.svg" alt="OpenLiteSpeed logo" /></figure><div class="sidetree__identity"><a class="sidetree__manual-link" href="index.html">Users' Manual</a><div class="sidetree__version">Version 1.9 — Rev. 4</div></div></div><nav class="sidetree__nav" aria-label="Table of Contents"><ul class="sidetree__list">
<li><a href="license.html">License</a></li>
<li><a href="intro.html">Introduction</a></li>
<li><a href="install.html">Installation/Uninstallation</a></li>
<li>
<a href="admin.html">Administration</a>
<ul class="level2">
<li><a href="ServerStat_Help.html">Service Manager</a></li>
<li><a href="Real_Time_Stats_Help.html">Real-Time Stats</a></li>
</ul>
</li>
<li><a href="security.html">Security</a></li>
<li>
<a href="config.html">Configuration</a>
<ul class="level2">
<li><a href="ServGeneral_Help.html">Server General</a></li>
<li><a href="ServLog_Help.html">Server Log</a></li>
<li><a href="ServTuning_Help.html">Server Tuning</a></li>
<li><a href="ServSecurity_Help.html">Server Security</a></li>
<li>
<a href="ExtApp_Help.html">External Apps</a>
<ul class="level3">
<li><a href="External_LSAPI.html">LSAPI App</a></li>
<li><a href="External_WS.html">Web Server (Proxy)</a></li>
<li><a href="External_FCGI.html">Fast CGI App</a></li>
<li><a href="External_FCGI_Auth.html">Fast CGI Authorizer</a></li>
<li><a href="External_SCGI.html">Simple CGI App</a></li>
<li><a href="External_Servlet.html">Servlet Engine</a></li>
<li><a href="External_PL.html">Piped Logger</a></li>
<li><a href="External_LB.html">Load Balancer</a></li>
<li><a href="External_UWSGI.html">uWSGI</a></li>
</ul>
</li>
<li><a href="ScriptHandler_Help.html">Script Handler</a></li>
<li><a href="App_Server_Help.html">App Server Settings</a></li>
<li><a href="Module_Help.html">Module Configuration</a></li>
<li><a href="Listeners_General_Help.html">Listener General</a></li>
<li><a href="Listeners_SSL_Help.html">Listener SSL</a></li>
<li><a href="Templates_Help.html">Virtual Host Templates</a></li>
<li><a href="VirtualHosts_Help.html">Virtual Host Registration</a></li>
<li><a href="VHGeneral_Help.html">Virtual Host General</a></li>
<li><a href="VHSecurity_Help.html">Virtual Host Security</a></li>
<li><a href="VHSSL_Help.html">Virtual Host SSL</a></li>
<li><a href="Rewrite_Help.html">Rewrite</a></li>
<li>
<a href="Context_Help.html">Context</a>
<ul class="level3">
<li><a href="Static_Context.html">Static Context</a></li>
<li><a href="Java_Web_App_Context.html">Java Web App Context</a></li>
<li><a class="current" href="Servlet_Context.html">Servlet Context</a></li>
<li><a href="FCGI_Context.html">Fast CGI Context</a></li>
<li><a href="SCGI_Context.html">Simple CGI Context</a></li>
<li><a href="LSAPI_Context.html">LSAPI Context</a></li>
<li><a href="Proxy_Context.html">Proxy Context</a></li>
<li><a href="CGI_Context.html">CGI Context</a></li>
<li><a href="LB_Context.html">Load Balancer Context</a></li>
<li><a href="Redirect_Context.html">Redirect Context</a></li>
<li><a href="App_Server_Context.html">App Server Context</a></li>
<li><a href="UWSGI_Context.html">uWSGI Context</a></li>
<li><a href="Module_Context.html">Module Handler Context</a></li>
</ul>
</li>
<li><a href="VHWebSocket_Help.html">Web Socket Proxy</a></li>
</ul>
</li>
<li><a href="webconsole.html">Web Console</a>
<ul class="level2">
<li><a href="AdminGeneral_Help.html">Admin Console General</a></li>
<li><a href="AdminSecurity_Help.html">Admin Console Security</a></li>
<li><a href="AdminListeners_General_Help.html">Admin Listener General</a></li>
<li><a href="AdminListeners_SSL_Help.html">Admin Listener SSL</a></li>
</ul>
</li>
</ul></nav></aside><article class="contentwrapper"><div class="nav-bar"><div class="prev">« <a href="Java_Web_App_Context.html">Java Web App Context</a></div><div class="center"><a href="Context_Help.html">Context</a></div><div class="next"><a href="FCGI_Context.html">Fast CGI Context</a> »</div></div>
<header class="doc-page-header"><h1>Servlet Context</h1></header><section class="doc-toc" aria-labelledby="top"><header class="doc-toc__header"><h2 id="top">Table of Contents</h2></header><section class="doc-toc__row"><h3 class="doc-toc__heading"><a href="#servletContext">Servlet Context</a></h3><ul class="doc-toc__links"><li><a href="#expuri">URI</a></li><li><a href="#servletEngine">Servlet Engine</a></li><li><a href="#extraHeaders">Header Operations</a></li><li><a href="#realm">Realm</a></li><li><a href="#authName">Authentication Name</a></li><li><a href="#required">Require (Authorized Users/Groups)</a></li><li><a href="#accessAllowed">Access Allowed</a></li><li><a href="#accessDenied">Access Denied</a></li><li><a href="#extAuthorizer">Authorizer</a></li><li><a href="#addDefaultCharset">Add Default Charset</a></li><li><a href="#defaultCharsetCustomized">Customized Default Charset</a></li><li><a href="#enableIpGeo">Enable GeoLocation Lookup</a></li></ul></section>
</section>
<section class="doc-content-flow"><div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="servletContext"><h3>Servlet Context<span class="ls-permlink"><a href="#servletContext"></a></span></h3></header><h4>Description</h4><p>Servlets can be imported individually through Servlet Contexts. A Servlet Context just specifies the URI for the servlet and the name of the servlet engine. You only need to use this when you do not want to import the whole web application or you want to protect different servlets with different authorization realms. This URI has the same requirements as for a <span class="tagl"><a href="#javaWebAppContext">Java Web App Context</a></span>.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="expuri"><h3>URI<span class="ls-permlink"><a href="#expuri"></a></span></h3></header><h4>Description</h4><p>Specifies the URI for this context.</p> <h4>Syntax</h4><p>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.</p> <h4>See Also</h4><p class="ls-text-small"><span class="tagl"><a href="#location">Location</a></span></p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="servletEngine"><h3>Servlet Engine<span class="ls-permlink"><a href="#servletEngine"></a></span></h3></header><h4>Description</h4><p>Specifies the name of the servlet engine that serves this web application. Servlet engines must be defined in the <span class="tagP"><a href="#ExtApp_Help">External Apps</a></span> section at the server or virtual host level.</p> <h4>Syntax</h4><p>Select from drop down list</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="extraHeaders"><h3>Header Operations<span class="ls-permlink"><a href="#extraHeaders"></a></span></h3></header><h4>Description</h4><p>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.</p> <h4>Syntax</h4><p>[Header]|RequestHeader [condition] set|append|merge|add|unset header [value] [early|env=[!]variable]</p> <h4>Example</h4><div class="ls-example">set Cache-control no-cache<br/> append Cache-control no-store<br/> Header set My-header cust_header_val<br/> RequestHeader set My-req-header cust_req_header_val</div><h4>Tips</h4><p><span class="ls-badge ls-badge--info">Information</span> Syntax and usage are similar to <a href="https://httpd.apache.org/docs/2.2/mod/mod_headers.html#header" target="_blank" rel="noopener noreferrer">Apache's mod_headers directives</a> for supported operations.<br/><br/> <span class="ls-badge ls-badge--info">Information</span> The 'Header' directive is is optional and can be excluded or left in when copying rules from elsewhere without issue.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="realm"><h3>Realm<span class="ls-permlink"><a href="#realm"></a></span></h3></header><h4>Description</h4><p>Specifies the authorization realm for this context. When specified, a valid username and password must be provided in order to access this context. <span class="tagl"><a href="VHSecurity_Help.html#realms">Authorization Realms</a></span> are set up in the <span class="tagP"><a href="#VHSecurity_Help">Virtual Host Security</a></span> section. This setting uses each realm's <span class="tagl"><a href="VHSecurity_Help.html#realmName">Realm Name</a></span>.</p> <h4>Syntax</h4><p>Select from drop down list</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="authName"><h3>Authentication Name<span class="ls-permlink"><a href="#authName"></a></span></h3></header><h4>Description</h4><p>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.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="required"><h3>Require (Authorized Users/Groups)<span class="ls-permlink"><a href="#required"></a></span></h3></header><h4>Description</h4><p>Specifies which user/group can access this context. This allows you to use one user/group database (specified in <span class="tagl"><a href="#realm">Realm</a></span>) across a number of contexts, but only allow certain users/groups from that database to access this context.</p> <h4>Syntax</h4><p>Syntax is compatible with Apache's Require directive. For example: <ul> <li><span class="val">user username [username ...]</span><br/> Only listed users can access this context.</li> <li> <span class="val">group groupid [groupid ...]</span><br/> Only users belonging to the listed groups can access this context.</li> </ul> If this setting is not specified, all valid users will be allowed to access this resource.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="accessAllowed"><h3>Access Allowed<span class="ls-permlink"><a href="#accessAllowed"></a></span></h3></header><h4>Description</h4><p>Specifies which IPs or sub-networks are allowed to access resources under this context. Together with <span class="tagl"><a href="#accessDenied">Access Denied</a></span> and server/virtual host level access control, accessibility is determined by the smallest scope that a client's IP address falls into.</p> <h4>Syntax</h4><p>Comma-delimited list of IPs/sub-networks.</p> <h4>Example</h4><div class="ls-example">Sub-networks can be written as <span class="val">192.168.1.0/255.255.255.0</span>, <span class="val">192.168.1</span>, or <span class="val">192.168.1.*</span>.</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="accessDenied"><h3>Access Denied<span class="ls-permlink"><a href="#accessDenied"></a></span></h3></header><h4>Description</h4><p>Specifies which IPs or sub-networks are NOT allowed to access resources under this context. Together with <span class="tagl"><a href="#accessAllowed">Access Allowed</a></span> and server/virtual host-level access control, accessibility is determined by the smallest scope that a client's IP address falls into.</p> <h4>Syntax</h4><p>Comma-delimited list of IPs/sub-networks.</p> <h4>Example</h4><div class="ls-example">Sub-networks can be written as <span class="val">192.168.1.0/255.255.255.0</span>, <span class="val">192.168.1</span>, or <span class="val">192.168.1.*</span>.</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="extAuthorizer"><h3>Authorizer<span class="ls-permlink"><a href="#extAuthorizer"></a></span></h3></header><h4>Description</h4><p>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 <a href=" https://fastcgi-archives.github.io/ " target="_blank" rel="noopener noreferrer"> https://fastcgi-archives.github.io/ </a>.</p> <h4>Syntax</h4><p>Select from drop down list</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="addDefaultCharset"><h3>Add Default Charset<span class="ls-permlink"><a href="#addDefaultCharset"></a></span></h3></header><h4>Description</h4><p>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 <span class="val">Off</span>, this function is disabled. When set to <span class="val">On</span>, either the character set specified by <span class="tagl"><a href="#defaultCharsetCustomized">Customized Default Charset</a></span> or the default "iso-8859-1" will be added.</p> <h4>Syntax</h4><p>Select from radio box</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="defaultCharsetCustomized"><h3>Customized Default Charset<span class="ls-permlink"><a href="#defaultCharsetCustomized"></a></span></h3></header><h4>Description</h4><p>Specifies a character set to be used when <span class="tagl"><a href="#addDefaultCharset">Add Default Charset</a></span> is <span class="val">On</span>. This is optional. The default value is <span class="val">iso-8859-1</span>. This entry has no effect when <span class="tagl"><a href="#addDefaultCharset">Add Default Charset</a></span> is <span class="val">Off</span>.</p> <h4>Syntax</h4><p>Name of a character set.</p> <h4>Example</h4><div class="ls-example">utf-8</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><header class="ls-helpitem__header" id="enableIpGeo"><h3>Enable GeoLocation Lookup<span class="ls-permlink"><a href="#enableIpGeo"></a></span></h3></header><h4>Description</h4><p> 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".</p> <h4>Syntax</h4><p>Select from radio box</p> <h4>See Also</h4><p class="ls-text-small"><span class="tagl"><a href="ServGeneral_Help.html#useIpInProxyHeader">Use Client IP in Header</a></span>, <span class="tagl"><a href="ServGeneral_Help.html#geoipDBFile">DB File Path</a></span>,</p> </article> </div>
</section>
</article></div><button class="doc-back-to-top" type="button" aria-label="Back to top" data-back-to-top><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 19V5" /><path d="m6 11 6-6 6 6" /></svg><span class="sr-only">Back to top</span></button><footer class="copyright">Copyright © 2013-2026. <a href="https://www.litespeedtech.com">LiteSpeed Technologies Inc.</a> All rights reserved.</footer>
</div>
</body>
</html>