Neokernel API

HTTPProxyAgent Class

HTTPProxyAgent handles proxies to other web servers. It can provide complete http proxy services to browsers and other clients connecting on the addresses and ports specified in the listeners property, and it can proxy specific URLs from the http.proxy file while the WebServer handles other requests normally.

The http.proxy file lists full URLs or URIs to proxy and where they should be proxied to if the WebServer is running. It consists of name/value pairs separated by newlines. Lines beginning with the # character are ignored as comments. The value of each name/value pair must be a complete URL.

Here are some valid name/value pairs that might be used in the http.proxy file:

http://myserver/proxy_me=http://proxy:1099
http://myserver/proxy_me2=http://proxy1:9000
http://myserver/proxy_me2=http://proxy2:9000
http://myserver/proxy_me2=http://proxy3:9000
When a browser requests /proxy_me, the HTTPProxyAgent contacts the web server at proxy on port 1099 and proxies the request to that server. When a browser requests /proxy_me_too, the HTTPProxyAgent cycles through the 3 web servers indicated, so that the first time the URL is accessed, the connection is proxied to proxy1:9000. The second time, the request is proxied to proxy2:9000, the third request goes to proxy3:9000, the fourth request goes to proxy1:9000, and so on. Both the name and the value of each name/value pair are assumed to be literal, so they will only match the exact path/hostname of the http request.

The servers listed in the http.proxy file are periodically checked to ensure that they are up and responding. The HTTPProxyAgent will not proxy requests to hosts from the http.proxy file that aren't responding.

HTTPProxyAgent also supports listeners, which operate independently of the WebServer to proxy traffic for browsers configured to use a proxy server. Any number of listeners can be started to provide proxy services on specific ports or IPs. Listeners are specified using the listeners prop of the HTTPProxyAgent.

This agent supports the following Props entries:
service_name
The name this agent uses to register with Service Manager. The WebServer's proxy_agent prop must be set to match this agent's service_name, or requests for urls in the http.proxy file will not be handed off to this agent. The default value is http_proxy.agent.
proxy_file
The path to a file containing a list of the available proxies. See above for syntax. Defaults to ./http.proxy
log_requests
When this prop is set to true, the agent will log requests handled by proxy listeners. Requests routed through the WebServer are logged in the WebServer's http logs. Defaults to true.
proxy_log_dir
The path to a directory containing proxy log files. Defaults to .\proxy_logs.
check_interval
Specifies the time to wait (in millisecs) before checking a proxy's status. Defaults to 300000
initial_wait_time
Specifies the time to wait after startup (in millisecs) before checking a proxy's status. Defaults to 600000
listeners
A comma separated list of hostnames or IP addresses (with port number) on which to provide standard HTTP proxy services for browsers. Requests on these ports won't be routed through the WebServer. By default, this prop is not set.
snoop_traffic
A boolean value that determines if data sent through the http proxy will be output to the console or file logger. By default, this prop is false.

For a list of all members of this type, see HTTPProxyAgent Members .

System.Object
   Props
      Agent
         ServiceAgent
            RequestAgent
               HTTPProxyAgent

public class HTTPProxyAgent : RequestAgent, IThreadRunnable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: com.neokernel.httpd

Assembly: Neokernel (in Neokernel.exe)

See Also

HTTPProxyAgent Members | com.neokernel.httpd Namespace