Apache Http Server Proxy



  • Apache HttpClient Tutorial

You can configure Apache HTTP Server as a reverse proxy for Rational DOORS Web Access. A reverse proxy server provides another layer of security, protects HTTP servers in the network, and improves the performance of Secure Sockets Layer (SSL) requests. With a reverse proxy, you can change your deployment topology later. The WLS Web Server Proxy Plug-In for Apache HTTP Server recognizes the parameters listed in Section 7.1, 'General Parameters for Web Server Plug-Ins'. To modify the behavior of your WLS Web Server Proxy Plug-In for Apache HTTP Server, define these parameters either: In a block, for parameters that apply to proxying by path,. Apache Traffic Server™ software is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server. Formerly a commercial product, Yahoo! Donated it to the Apache Foundation, and currently used by several major CDNs and content owners.

  • Apache HttpClient Resources

Apache is a tried and tested HTTP server which comes with access to a very wide range of powerful extensions. Although it might not seem like the go-to choice in terms of running a reverse-proxy, system administrators who already depend on Apache for the available rich feature-set can also use it as a gateway to their application servers. This page describes one possible way to use Apache HTTP Server 2.4 to proxy requests for Confluence running in a standard Tomcat container. You can find additional documentation that explains how to use NGINX for the same purpose.

  • Selected Reading

A Proxy server is an intermediary server between the client and the internet. Proxy servers offer the following basic functionalities −

  • Firewall and network data filtering

  • Network connection sharing

  • Data caching

Using HttpClient library, you can send a HTTP request using a proxy. Follow the steps given below −

Step 1 - Create a HttpHost object

Instantiate the HttpHost class of the org.apache.http package by passing a string parameter representing the name of the proxy host, (from which you need the requests to be sent) to its constructor.

In the same way, create another HttpHost object to represent the target host to which requests need to be sent.

Step 2 - Create an HttpRoutePlanner object

The HttpRoutePlanner interface computes a route to a specified host. Create an object of this interface by instantiating the DefaultProxyRoutePlanner class, an implementation of this interface. As a parameter to its constructor, pass the above created proxy host −

Httpd

Step 3 - Set the route planner to a client builder

Using the custom() method of the HttpClients class, create a HttpClientBuilder object and, to this object set the route planner created above, using the setRoutePlanner() method.

Step 4 - Build the CloseableHttpClient object

Build the CloseableHttpClient object by calling the build() method.

Step 5 - Create a HttpGetobject

Create a HTTP GET request by instantiating the HttpGet class.

Step 6 - Execute the request

One of the variants of the execute() method accepts an HttpHost and HttpRequest objects and executes the request. Execute the request using this method −

Example

Following example demonstrates how to send a HTTP request to a server via proxy. In thisexample, we are sending a HTTP GET request to google.com via localhost. We have printed the headers of the response and the body of the response.

Apache Httpd Proxy

Output

Apache Proxy Module

On executing, the above program generates the following output −