Menu

Web dispatch plugin

The rabbitmq-web-dispatch plugin provides hosting for other plugins that have HTTP interfaces. It allows these interfaces to co-exist on one or more HTTP listeners.

Configuration

Plugins using rabbitmq-web-dispatch typically take a listener configuration item to configure their listening HTTP port. In this page we will give examples for the rabbitmq_management application, but the same configuration can be applied to rabbitmq_jsonrpc and rabbitmq_web_stomp_examples.

The listener configuration item can contain the following keys:

  • port (mandatory)
  • ip (to listen on only one interface)
  • ssl (to enable SSL)
  • ssl_opts (to configure SSL)
  • cowboy_opts (to configure the Cowboy HTTP server)

Listening on a single interface

Use ip to specify an interface for Cowboy to bind to (giving an IP address as a string or tuple). For example:

[{rabbitmq_management,
  [{listener, [{port, 15672},
               {ip, "127.0.0.1"}
              ]}
  ]}
].

TLS

Set ssl to true to turn on SSL for a listener. Use ssl_opts to specify SSL options. These are the standard TLS listener options, see the TLS guide for more information.

For convenience, if you do not specify ssl_opts then rabbitmq-web-dispatch will use the same options as the main RabbitMQ server does for AMQP over SSL, but with client certificate verification turned off. If you wish to use client certificate verification, specify ssl_opts explicitly.

For example:

[{rabbitmq_management,
  [{listener, [{port,     15672},
               {ssl,      true},
               {ssl_opts, [{cacertfile, "/path/to/cacert.pem"},
                           {certfile,   "/path/to/cert.pem"},
                           {keyfile,    "/path/to/key.pem"}]}
              ]}
  ]}
].

Compressed responses

Cowboy provides a number of options that can be used to customize the behavior of the server. You can specify those in the listener options under cowboy_opts.

To compress responses, set the proper cowboy_opts option:

[{rabbitmq_management,
  [{listener, [{port,        15672},
               {cowboy_opts, [{compress, true}]}
              ]}
  ]}
].