<abstract>This document defines an XMPP Extension Protocol for discovering alternative methods of connecting to an XMPP server via Web Host Metadata Link format.</abstract>
<remark><p>Fix reference to RFC 6415 and organize requirements more clearly. This raises the JSON requirement from MAY (OPTIONAL) to SHOULD (effectively), to accustom web-based software.</p></remark>
<remark><p>Per a vote of the XMPP Council, advanced status to Draft; XMPP Registrar assigned alt-connections shortname and created appropriate registry.</p></remark>
<remark><p>Finally and definitively removed _xmpp-client-tcp and _xmpp-server-tcp attributes since clients and servers should use either SRV records or standard XMPP ports (5222 or 5269).</p></remark>
<remark><p>Clarified order of lookups; restored _xmpp-client-tcp and added _xmpp-server-tcp as optional records if SRV is not supported or accessible.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2005-12-05</date>
<initials>psa</initials>
<remark><p>Removed _xmpp-client-tcp from TXT records (belongs in SRV records only).</p></remark>
<p>Although &xmppcore; specifies the use of TCP as the method of connecting to an XMPP server, alternative connection methods exist, including the &xep0124; method (for which &xep0206; is the XMPP profile) and the websocket subprotocol specified in &rfc7395;. For some of these methods, it is necessary to discover further parameters before connecting, such as the HTTP URL of an alternative connection manager. Without ways to auto-discover alternative connection methods, the relevant information would need to be provided manually by a human user (which is cumbersome and error-prone) or hard-coded into XMPP software applications (which is brittle and not interoperable).</p>
<p>This document defines a way to encapsulate information about alternative connection methods for auto-discovery via Link entries in a server's "host-meta" file.
<p>The HTTP lookup method uses Web Host Metadata &rfc6415; to categorize and list the URIs of alternative connection methods. It is primarily intended for use by clients in environments where the ability to perform DNS queries is restricted, such as in web browsers.</p>
<p>Each alternative connection method is specified in the host-meta (XRD) file using a distinctive link relation &rfc5988;. This specification defines several extension relation types:</p>
<li>host-meta files MUST be fetched only over HTTPS, and MUST only use connection URLs starting with 'https://' or 'wss://'. This provides secure delegation, meaning you SHOULD send SNI matching the host of the URL from the connection URL and validate that the certificate is valid for that host *or* the XMPP domain.</li>
<li>Services implementing this XEP MUST offer the information in the Extensible Resource Descriptor (XRD) format and SHOULD additionally provide the JRD format (both formats are specified in &rfc6415;).</li>
<li>HTTPS queries for host-meta information MUST be used only as a fallback after the methods specified in <cite>RFC 6120</cite> have been exhausted.</li>
<li>The order of XMPP related link entries in the host-meta file SHOULD NOT be interpreted as significant by the presenting domain or the receiving entity.</li>
<p>The following examples show two host-meta link records: the first indicates support for the XMPP Over BOSH connection method defined in <cite>XEP-0124</cite> and <cite>XEP-0206</cite> and the second indicates support for the XMPP Over WebSocket connection method defined in &rfc7395;.</p>
<p>It is possible to use additionally a JSON-based format for host-meta information. The JSON representation of the host metadata is named JRD and specified in Appendix A of &rfc6415;. The above XRD example would be presented in JRD as:</p>
<p>To make connection discovery work in web clients (including those hosted on a different domain) the host service SHOULD set appropriate <linkurl="https://www.w3.org/TR/cors/">CORS</link> headers for Web Host Metadata files. The exact headers and values are out of scope of this document but may include: <em>Access-Control-Allow-Origin</em>, <em>Access-Control-Allow-Methods</em> and <em>Access-Control-Allow-Headers</em>.</p>
<p>Due care has to be exercised in limiting the scope of <em>Access-Control-Allow-Origin</em> response header to Web Host Metadata files only.</p>
<codecaption="Example header allowing all sites to read host metadata"><![CDATA[
Access-Control-Allow-Origin: *
]]></code>
<pclass="box"><em>Access-Control-Allow-Origin</em> header with a value of <em>*</em> allows JavaScript code running on a different domain to read the content of Web Host Metadata files. Special value <em>*</em> ensures that the request will only succeed if it is <linkurl="https://www.w3.org/TR/cors/#resource-requests">invoked without user credentials</link> (e.g. cookies, HTTP authentication).</p>
<p>It is possible that advertisement of alternative connection methods can introduce security vulnerabilities, since a connecting entity (usually a client) might deliberately seek to connect using the method with the weakest security mechanisms (e.g., no channel encryption or relatively weak authentication). Care needs to be taken in determining which alternative connection methods are appropriate to advertise or implement in your lookup.</p>
<p>Entities that use these connection methods MUST only fetch host-meta over Transport Layer Security (TLS), and MUST only use 'https' or 'wss' URLs that are protected using TLS.</p>
<p>A previous version of this XEP defined a DNS method to look up this info using a TXT <em>_xmppconnect</em> record, this was insecure and has been removed.</p>
<p>Because the link relations specified here are extension relation types rather than registered relation types (see Section 4 of RFC 5988), this document requires no interaction with &IANA;.</p>