HTTP configuration

HTTP is the main method through which applications receive requests. The following section describes how to configure HTTP for a IBM® WebSphere® sMash application.

Configuring HTTP Port

You can configure HTTP settings for individual applications. By default, the HTTP protocol uses port 8080 for each application. To override this default, use the following steps to enter a new port number:
  1. Open the <apphome>/config/zero.config file in your favorite text editor.
  2. Add a /config/http/port entry in the <apphome>/config/zero.config file, or edit if it already exists, as shown in the following example:
/config/http/port=8081
After starting the application you just configured, you can access it over HTTP using the new port. For example, if you used port 8081 in the configuration file for an application called myApp you can access your application using:
http://localhost:8081/

Binding to a single local IP address

It is possible to have the application bind the HTTP server to a single IP address on a machine. To do this, add the /config/http/ipAddress entry to your configuration file, as shown in the following example:
/config/http/ipAddress="10.0.0.1"
If no specific IP address is configured, then any requests coming in on any of the machine's network adapters will be accepted.

Disabling the HTTP Port

If you set the HTTP port to -1, then HTTP access will be disabled and no inbound HTTP port will be opened. To disable HTTP, use the following configuration entry:

/config/http/port=-1

HTTP should only be disabled if HTTPS is enabled. If both are disabled, your application will not be allowed to start.

Configuring HTTP Access Logging

WebSphere sMash can be configured to log particulars of HTTP requests and responses by setting the /config/accessLogging to true. The format of the access log conforms to the NCSA common log format. Access Logging is enabled by default.

To disable, set the configuration directive to false.

/config/accessLogging=false

The access logs will be written to the access.log file in the logs directory of the application. Each line of the log file corresponds to one HTTP request-response pair. By default up to 10MB of logs will be written to a file before WebSphere sMash starts writing to another log file. WebSphere sMash will keep a maximum of 10 backup log files before recycling the log files.

Compressing HTTP response

WebSphere sMash enables applications to compress HTTP responses to save bandwidth. By default, HTTP responses are not compressed. To compress HTTP responses, add the following directive to the application's configuration file:

/config/compressResponse=true

The response is compressed only if the client indicates that it can accept a compressed response by including the HTTP header Accept-Encoding with a value of either gzip or deflate as shown below.

Accept-Encoding: gzip,deflate

For more details on content negotiation, please refer to the HTTP specification

Version 1.0.0.3.25591