Skip to content

Configuring SSL on listeners with multiple hosts #2228

@cogentParadigm

Description

@cogentParadigm

MongooseIM version: 3.2.0
Installed from: source
Erlang/OTP version: 21

This is probably just my ignorance but I haven't been able to get listeners working on multiple SSL enabled hosts. I have them defined under host_config blocks like so:

{host_config, "dev.example.com", [
  {listen, [
    %% BOSH and WS endpoints over HTTPS
    { 5285, ejabberd_cowboy, [
      {num_acceptors, 10},
      {transport_options, [{max_connections, 1024}]},
      {ssl, [
          {certfile, "/path/to/certs/dev.example.com.crt"},
          {keyfile, "/path/to/keys/dev.example.com.key"}
      ]},
      {modules, [
        {"_", "/http-bind", mod_bosh},
        {"_", "/ws-xmpp", mod_websockets, []}
      ]}
    ]},
    { 8089 , ejabberd_cowboy, [
      {num_acceptors, 10},
      {transport_options, [{max_connections, 1024}]},
      {protocol_options, [{compress, true}]},
      {ssl, [
          {certfile, "/path/to/certs/dev.example.com.crt"},
          {keyfile, "/path/to/keys/dev.example.com.key"}
      ]},
      {modules, [
          {"_", "/api/sse", lasse_handler, [mongoose_client_api_sse]},
          {"_", "/api/messages/[:with]", mongoose_client_api_messages, []},
          {"_", "/api/contacts/[:jid]", mongoose_client_api_contacts, []},
          {"_", "/api/rooms/[:id]",    mongoose_client_api_rooms, []},
          {"_", "/api/rooms/[:id]/config",    mongoose_client_api_rooms_config, []},
          {"_", "/api/rooms/:id/users/[:user]",    mongoose_client_api_rooms_users, []},
          {"_", "/api/rooms/[:id]/messages",    mongoose_client_api_rooms_messages, []}
      ]}
    ]}
  ]}
]}.

{host_config, "example.com", [
  {listen, [
    %% BOSH and WS endpoints over HTTPS
    { 5285, ejabberd_cowboy, [
      {num_acceptors, 10},
      {transport_options, [{max_connections, 1024}]},
      {ssl, [
          {certfile, "/path/to/certs/example.com.crt"},
          {keyfile, "/path/to/keys/example.com.key"}
      ]},
      {modules, [
        {"_", "/http-bind", mod_bosh},
        {"_", "/ws-xmpp", mod_websockets, []}
      ]}
    ]},
    { 8089 , ejabberd_cowboy, [
      {num_acceptors, 10},
      {transport_options, [{max_connections, 1024}]},
      {protocol_options, [{compress, true}]},
      {ssl, [
          {certfile, "/path/to/certs/example.com.crt"},
          {keyfile, "/path/to/keys/example.com.key"}
      ]},
      {modules, [
          {"_", "/api/sse", lasse_handler, [mongoose_client_api_sse]},
          {"_", "/api/messages/[:with]", mongoose_client_api_messages, []},
          {"_", "/api/contacts/[:jid]", mongoose_client_api_contacts, []},
          {"_", "/api/rooms/[:id]",    mongoose_client_api_rooms, []},
          {"_", "/api/rooms/[:id]/config",    mongoose_client_api_rooms_config, []},
          {"_", "/api/rooms/:id/users/[:user]",    mongoose_client_api_rooms_users, []},
          {"_", "/api/rooms/[:id]/messages",    mongoose_client_api_rooms_messages, []}
      ]}
    ]}
  ]}
]}.

That didn't seem to work. Is this the correct approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityNon ESL issues and PRsin backlogCommunity request added to backlog and waiting for implementation.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions