Service-Defaults Reference

This document describes all of the elements and properties you can use to configure Kaazing WebSocket Gateway service-defaults.

Overview

You can use the optional service-defaults element to configure certain default options across all services running on the Gateway.

Structure

The Gateway configuration file (gateway-config.xml or gateway-config-minimal.xml) defines the service-defaults configuration element contained in the top-level gateway-config element:

service-defaults

Each service-defaults element can contain any of the following subordinate elements:

Subordinate Element Description
accept-options Options for the accept element (see accept-options (service-defaults))
mime-mapping Mappings of file extensions to MIME types. Each mime-mapping entry defines the HTTP Content-Type header value to be returned when a client or browser requests a file that ends with the specified extension (see mime-mapping (service-defaults))

accept-options (service-defaults)

The service-defaults section can contain the following accept-options:

  • ssl.ciphers: specifies the TLS/SSL ciphers used by Kaazing WebSocket Gateway on secure connections
  • ssl.encryption: signals Kaazing WebSocket Gateway to enable or disable encryption on incoming traffic
  • protocol.bind: binds the URL(s) on which the service accepts connections (defined by the accept element)
  • ws.maximum.message.size: configures the maximum incoming WebSocket message size allowed by the Gateway
  • http.keepalive.timeout: configures the duration the Gateway waits between responding to an HTTP or HTTPS connection request and the subsequent request
  • http.server.header: enables or disables the inclusion of the HTTP server header

If you then specify values for accept-options on a particular service, the service accept options supercede the default values with your specified values. If there are no explicit accept-options for a particular service, the service uses these default values.

Example

The following example shows ssl.encryption disabled, sample network protocol bindings, ws.maximum.message.size set to 256k, and http.keepalive.timeout set to 90 seconds, just above the default mime-mapping entries, as shown in lines 2-10:

<service-defaults>
  <accept-options>
    <ssl.encryption>disabled</ssl.encryption>
    <ws.bind>8050</ws.bind>
    <wss.bind>192.168.10.25:8055</wss.bind>
    <http.bind>192.168.10.25:8060</http.bind>
    <https.bind>192.168.10.25:8065</https.bind>
    <ws.maximum.message.size>256k</ws.maximum.message.size>
    <http.keepalive.timeout>90</http.keepalive.timeout>
  </accept-options>

  <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>
  .
  .
  .
  </service-defaults>

mime-mapping (service-defaults)

The mime-mapping element defines the way the Gateway maps a file extension to a MIME type. The service-defaults section in the default Gateway configuration file contains default MIME type mappings that apply to all services on the Gateway.

Example

The following example shows two entries for the same file extension; in this case, when the Gateway receives a request for a file with an HTML extension, the Gateway will respond with a Content-Type header value of text/html (not image/png) as shown in lines 1-4 and 9-12:

  <mime-mapping>
    <extension>html</extension>
    <mime-type>image/png</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>

Notes

  • When the Gateway responds to a file request, such as from the directory service, the response includes a Content-Type header based on the filename extension of the requested file. The Content-Type header value is the specified MIME type for that extension. If the file extension is not mapped to a MIME type by a mime-mapping element, the Gateway does not include a Content-Type header in its response.
  • You can specify MIME types for file extensions either in the service-defaults section or in a service. Specifying MIME types for file extensions in a service overrides any existing corresponding mime-mapping entries in the service-defaults section. See service for more information.
  • If you specify two or more mime-mapping entries for the same extension in a single service or in service-defaults, the Gateway only applies the last mime-mapping entry for that extension.
  • The service-defaults section in the default Gateway configuration includes the following standard mappings. You can modify these entries, but keep in mind that all mime-mapping entries must come after any accept-options you add to this section.

    Note: The Gateway has hard-coded internal MIME mappings that are equivalent to those provided in the service-defaults section of the gateway-config.xml, for backward compatibility with earlier releases of Kaazing WebSocket Gateway. You cannot remove these internal settings. You can, however, override them with new MIME-type values.

    The default Gateway mime-mapping entries are:
    <service-defaults>
      <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>htm</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>js</extension>
        <mime-type>text/javascript</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>png</extension>
        <mime-type>image/png</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>gif</extension>
        <mime-type>image/gif</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>jpg</extension>
        <mime-type>image/jpeg</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>jpeg</extension>
        <mime-type>image/jpeg</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>css</extension>
        <mime-type>text/css</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>swf</extension>
        <mime-type>application/x-shockwave-flash</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>xap</extension>
        <mime-type>application/x-silverlight-app</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>htc</extension>
        <mime-type>text/x-component</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>jnlp</extension>
        <mime-type>application/x-java-jnlp-file</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>manifest</extension>
        <mime-type>text/cache-manifest</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>appcache</extension>
        <mime-type>text/cache-manifest</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>vtt</extension>
        <mime-type>text/vtt</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>aspx</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      </service-defaults>
    

Summary

In this document, you learned about the Gateway service-defaults configuration element and how to specify it in your Gateway configuration file. For more information about the location of the configuration files and starting the Gateway, see Setting Up Kaazing WebSocket Gateway. For more information about Kaazing WebSocket Gateway administration, see the documentation.

TOP