Router

The Stackato Router role manages HTTP and HTTPS traffic between web clients and application instances. In conjunction with the Cloud Controller, it maps application URLs to the corresponding application instances running in Linux containers on DEA nodes, distributing load between multiple instances (containers) as required.

Stackato's default router ('router2g') supports WebSocket (including "wss://" secure web sockets) and SPDY.

Settings

The Router is configured using kato config. The following settings are configurable:

  • client_inactivity_timeout: time (in seconds) the router waits for idle clients (default 1200 seconds). To change this:

    $ kato config set router2g client_inactivity_timeout 2400
  • backend_inactivity_timeout: time (in seconds) the router waits for applications to respond (default 1200 seconds). To change this:

    $ kato config set router2g client_inactivity_timeout 2400
  • prevent_x_spoofing (true|false): Enable HTTP "X-" header spoofing prevention (default 'false'). When enabled, the router discards all X- headers sent by the client (e.g. X-Forwarded-For, X-Forwarded-proto, X-Real-IP, etc.) and replaces them with values determined by the router itself. Anti-spoofing features should only be set at the network gateway, so this option should not be enabled when routers are configured behind an external load balancer. To enable:

    $ kato config set router2g prevent_x_spoofing true --json

WebSockets

Applications using web sockets must use the VCAP_APP_PORT or PORT environment variables to set the default listener port of the WebSocket server.

Legacy Router

The older, NGINX-based router (found in most Cloud Foundry systems) does not support WebSockets or SPDY but may be substituted for 'router2g' if required (e.g. to enable JSESSIONID support). To use the legacy router, run the following command:

$ kato config push cluster alternative_processes legacy_router

To disable 'legacy_router' and revert back to using 'router':

$ kato config pop cluster alternative_processes legacy_router

In a cluster, these commands will configure all router nodes automatically.

Table Of Contents

Previous topic

Detailed Configuration

Next topic

Log Streams