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:

management.listener.port = 15672
management.listener.ip   = 127.0.0.1

Or, using the classic config format:

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

TLS/SSL

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

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

For example:

management.listener.port = 15672
management.listener.ssl  = true

management.listener.ssl_opts.cacertfile = /path/to/cacert.pem
management.listener.ssl_opts.certfile   = /path/to/cert.pem
management.listener.ssl_opts.keyfile    = /path/to/key.pem

The same example using the classic config format:

[{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}]}
              ]}
  ]}
].