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

Use domain.tld for both XMPP and website #115

Closed
roughnecks opened this issue Jan 25, 2024 · 9 comments
Closed

Use domain.tld for both XMPP and website #115

roughnecks opened this issue Jan 25, 2024 · 9 comments
Labels
question Further information is requested

Comments

@roughnecks
Copy link

Hello,

I have my prosody server at woo...t.space and I have my website at the same domain

Is there a way for me to host the webchat, so that it doesn't collide with my website?

I can host at a subdomain, but then my login credential don't work, since it tries to connect to e.g. webchat.woo...t.space, which is not my xmpp server's virtualhost.

@nioc
Copy link
Owner

nioc commented Jan 25, 2024

Hello, it is possible with configuration in local.js

Let's say you have webdomain for the web GUI and xmppdomain for XMPP domain:

var config = {
  name: 'XMPP web',
  transports: {
    websocket: 'wss://webdomain/xmpp-websocket',
  },
  hasGuestAccess: false,
  hasRegisteredAccess: true,
  anonymousHost: 'anon.xmppdomain',
  isTransportsUserAllowed: false,
  hasHttpAutoDiscovery: false,
  resource: 'Web XMPP',
  defaultDomain: 'xmppdomain',
  defaultMuc: 'conference.xmppdomain',
  isStylingDisabled: false,
  hasSendingEnterKey: false,
  connectTimeout: 5000,
  pinnedMucs: ['welcome@conference.xmppdomain'],
}

And in proxy conf in Apache (for your webdomain):

<VirtualHost *:8810>
        ServerName   webdomain
        ServerAlias  webdomain
        # (...)
        # websocket proxy
        <IfModule mod_proxy_wstunnel.c>
                <Location "/xmpp-websocket">
                        ProxyPass "ws://xmppdomain:5280/xmpp-websocket"
                </Location>
        </IfModule>
</VirtualHost>

@nioc nioc added the question Further information is requested label Jan 25, 2024
@roughnecks
Copy link
Author

Hi.

came up with this (using nginx) but I still have problems authenticating: https://paste.woodpeckersnest.space/?c7a8446104c74c16#D3sUYFgrpE4WL9AouWRR2SPdMYUMFGCwb3eJeXSNiR45

@roughnecks
Copy link
Author

This error is repeating in console:

index-0eca49fe.js:15 XMPP error WebSocket ECONNERROR ws://localhost/xmpp-websocket
(anonymous) @ index-0eca49fe.js:15
Ye.emit @ index-0eca49fe.js:15
s.error @ index-0eca49fe.js:15
Ye.emit @ index-0eca49fe.js:15
s.error @ index-0eca49fe.js:15
error (async)
_attachSocket @ index-0eca49fe.js:15
connect @ index-0eca49fe.js:15
connect @ index-0eca49fe.js:15
connect @ index-0eca49fe.js:15
TS.t.connect @ index-0eca49fe.js:15
reconnect @ index-0eca49fe.js:15
(anonymous) @ index-0eca49fe.js:15
setTimeout (async)
scheduleReconnect @ index-0eca49fe.js:15
s.disconnect @ index-0eca49fe.js:15
Ye.emit @ index-0eca49fe.js:15
_status @ index-0eca49fe.js:15
s.close @ index-0eca49fe.js:15
Ye.emit @ index-0eca49fe.js:15
s.close @ index-0eca49fe.js:15
index-0eca

why does it say localhost?

@nioc
Copy link
Owner

nioc commented Jan 25, 2024

Can you type window.config.transports.websocket in console please?

@nioc
Copy link
Owner

nioc commented Jan 25, 2024

On XmppSocket.js, it create a XMPP object with the socket in service attribute.
If no value is provided, the XmppClient.js use ws://localhost:5280/xmpp-websocket as default.

I'm betting on an error in your local.json file.

@nioc
Copy link
Owner

nioc commented Jan 25, 2024

@roughnecks I think it works now 😉
image

@nioc nioc closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
@roughnecks
Copy link
Author

window.config.transports.websocket

'ws://localhost/xmpp-websocket'

did you check my paste? Config is there

@roughnecks
Copy link
Author

working now, not sure if this line was needed:

// eslint-disable-next-line no-unused-vars, no-var

@nioc
Copy link
Owner

nioc commented Jan 26, 2024

Not useful in production, it is for avoid linter complaints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants