processone / docker-ejabberd

Set of ejabberd Docker images
95 stars 77 forks source link

XEP-0156 with http lookup method #74

Closed diesl closed 2 years ago

diesl commented 3 years ago

I have running an ejabberd docker container that is working fine. However, I have not found any documentation how I can use XEP-0156 with http lookup.

How can I make /.well-known/host-meta information available?

badlop commented 3 years ago

I didn't read in detail that XEP, so I may be forgetting something. I understand that your question is "How to configure ejabberd to provide a result like Example 2?"

A quick way, in case this is enough for you:

Create the file yourself. I wrote this example:

❯ ls /tmp/wellknown 
host-meta

❯ cat /tmp/wellknown/host-meta   
<?xml version='1.0' encoding='utf-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  ...
  <Link rel="urn:xmpp:alt-connections:xbosh"
        href="https://web.example.com:5280/bosh" />
  <Link rel="urn:xmpp:alt-connections:websocket"
        href="wss://web.example.com:443/ws" />
  ...
</XRD>

Configure ejabberd:

listen:
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    tls: false
    request_handlers:
      /.well-known/: mod_http_fileserver

modules:
  mod_http_fileserver:
    docroot: "/tmp/wellknown"

Start ejabberd, and check it works:

❯ curl http://localhost:5280/.well-known/host-meta
<?xml version='1.0' encoding='utf-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  ...
  <Link rel="urn:xmpp:alt-connections:xbosh"
        href="https://web.example.com:5280/bosh" />
  <Link rel="urn:xmpp:alt-connections:websocket"
        href="wss://web.example.com:443/ws" />
  ...
</XRD>
diesl commented 2 years ago

@badlop Thank you for your quick answer. Finally I was able to work again on this issue.

Your proposed solution is working fine for me 👍

badlop commented 2 years ago

By the way, ejabberd 22.05 includes mod_host_meta, which makes a lot easier to provide that feature

zfkdnop commented 1 year ago

https://compliance.conversations.im appears to indicate XEP-0156 implementation is invalid even when it is configured correctly. I configured my node using both methods suggested above (mod_http_fileserver and mod_host_meta) and continue to receive a red X next to XEP-0156: Discovering Alternative XMPP Connection Methods (HTTP) yet the host-meta and host-meta.json files are able to be accessed.

Can anyone else confirm this?