HTTP configuration
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:- Open the
<apphome>/config/zero.configfile in your favorite text editor. - Add a
/config/http/portentry in the<apphome>/config/zero.configfile, or edit if it already exists, as shown in the following example:
myApp you can access your application using:
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:
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:
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.
Apache Access Logging
It is possible for a sMash application to use the same customizable log formats that are available in the Apache HTTP Server. This allows log processing tools that have been developed to parse Apache logs to be used with sMash applications. To use a custom access logging format, add the following configuration stanza to the config file.
In the previous configuration stanza, the Apache Access Logger has been configured to
the Common Log Format (CLF). Every '%' sign followed by a single character has a specific meaning.
For example, %h is the remote host. Optionally arguments are provided in {}.
For example, %C is a cookie received by the server. %{zsessionid}C is the zsessionid or the sMash session cookie as received by the server.
The Details of this format can be found at Apache Module mod_log_config.
To disable, set the configuration directive to 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:
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.
For more details on content negotiation, please refer to the HTTP specification