Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to configure WS/BOSH URL directly? #7

Closed
poVoq opened this issue Jan 8, 2020 · 11 comments
Closed

Option to configure WS/BOSH URL directly? #7

poVoq opened this issue Jan 8, 2020 · 11 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@poVoq
Copy link

poVoq commented Jan 8, 2020

Would be great if there was a way to configure the websocket or BOSH URL directly and not depend on the Apache2 proxy.

Both for running it on a shared server that doesn't allow modification of the Apache2 config and for use as a stand alone HTML5 app.

Thanks :)

Edit: or is it sufficient to modify the local.js?
Would be still nice to be able to configure it as a parameter.

@nioc
Copy link
Owner

nioc commented Jan 8, 2020

Hello.
I did not take the time to produce installation.md 🙁
But yes, you can edit the local.js file with your own endpoints :

    websocket: 'wss://chat.domain-web.ltd/xmpp-websocket',
    bosh: 'https://chat.domain-web.ltd/http-bind',

However, you may experience CORS issues if XMPP listener and chat app are not on the same domain.

Keep me informed if it works as you expected 🙂

@nioc nioc added the question Further information is requested label Jan 8, 2020
@poVoq
Copy link
Author

poVoq commented Jan 8, 2020

Yes, I tested it with a totally different domain and it seems to work fine in Firefox. My WSS/BOSH is running on ejabberd with a traefik.io reverseproxy. Thanks for the confirmation.

Would be still nice if there was a way to configure this in the login screen (advanced settings?) and if
https://xmpp.org/extensions/xep-0156.html was supported to auto-discover the WS/BOSH URL of your XMPP server.

@nioc
Copy link
Owner

nioc commented Jan 8, 2020

I take a quick look, this XEP is not in Stanza supported XEPs.
However if you need this, I can implement the HTTP lookup on chat.domain-web.ltd/.well-known/host-meta.json for override config.transports at bootstrap.

@poVoq
Copy link
Author

poVoq commented Jan 8, 2020

That would still leave it to the server admin to configure the URL, no?

The main idea is that there would be a default WS/BOSH URL, but if people want to connect with another XMPP server they could configure (or XEP-156 does it automatically) it themselves before login.

@nioc
Copy link
Owner

nioc commented Jan 8, 2020

That is the purpose of auto-discovery as described in the XEP 😄
For your need, here is my proposal: adding a boolean for showing or not (default value) 2 new fields ("Transport method" bosh/ws and "transport url") on login component.
That's ok for you?

@nioc nioc added the enhancement New feature or request label Jan 8, 2020
@poVoq
Copy link
Author

poVoq commented Jan 8, 2020

Yeah, that would certainly work. Thanks for considering it!

@nioc nioc self-assigned this Jan 8, 2020
@nioc nioc removed the question Further information is requested label Jan 8, 2020
@bremensaki
Copy link

Even if not implemented in Stanza, it's just a DNS lookup and/or a HTTP request to a .well-known URL for the JID domain which can be pulled from Stanza. Would attempting to pull _xmppconnect.jid-domain.org and populating the bosh/ws values that way be a problem?

I'm just starting to look around the code here, and I'll take a shot at it unless you think there's some good reason that it wouldn't be straightforward.

Do you have a MUC to discuss this project? I'm happy to maintain something on chinwag.im for it if you don't have a preferred server.

@nioc
Copy link
Owner

nioc commented Jan 11, 2020

Hello, I just added the two functionalities:

  • allow users to provide their own bosh/websocket URL (admin can disable this with isTransportsUserAllowed in local.js), impacting login GUI:
    XMPP web - issue 7

  • auto-discovery from HTTP Lookup as XEP 0156 described (only JSON format /.well-known/host-meta.json), it is disabled by default (enable it with hasHttpAutoDiscovery in local.js)

nioc added a commit that referenced this issue Jan 11, 2020
@nioc nioc closed this as completed in 206c5d1 Jan 11, 2020
@nioc
Copy link
Owner

nioc commented Jan 11, 2020

@bremensaki Thanks for proposition 😃
I prefer talking on the repo if someone wants to join us

@nioc nioc added this to the 0.5.0 milestone Jan 11, 2020
@poVoq
Copy link
Author

poVoq commented Jan 12, 2020

Awesome, thanks a lot for adding this.

Is "xmpp-websocket" the default for Prosody?

In ejabberd the defaults are "/ws" and "/bosh" which are arguably the more common defaults with non-selfhosted servers.

@bremensaki
Copy link

Yes, Prosody defaults are xmpp-websocket and http-bind for BOSH. It looks a bit clunky I agree, but it's easily changed and it's not usually something end users have to see and deal with anyway. I usually just reverse proxy everything from nginx anyway, and use /ws and /bosh there just because it's easier to type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants