nioc / xmpp-web

Lightweight web chat client for XMPP server
GNU Affero General Public License v3.0
142 stars 20 forks source link

Install from archive #60

Closed vladosam closed 2 years ago

vladosam commented 2 years ago

Unable to install xmpp-web from source. I get blank screen with just XMPP web on tab name. In dev tools i see uncaught error

07:33:05.896 Uncaught Error: 
    Fi https://myserver.com/assets/index.d50a2727.js:20
    c https://myserver.com/assets/index.d50a2727.js:20
    j https://myserver.com/assets/index.d50a2727.js:20
    re https://myserver.com/assets/index.d50a2727.js:20
    re https://myserver.com/assets/index.d50a2727.js:20
    H https://myserver.com/assets/index.d50a2727.js:20
    install https://myserver.com/assets/index.d50a2727.js:20
    use https://myserver.com/assets/index.d50a2727.js:1
    <anonymous> https://myserver.com/assets/index.d50a2727.js:71
index.d50a2727.js:20:5678
    Fi https://myserver.com/assets/index.d50a2727.js:20
    c https://myserver.com/assets/index.d50a2727.js:20
    j https://myserver.com/assets/index.d50a2727.js:20
    re https://myserver.com/assets/index.d50a2727.js:20
    re https://myserver.com/assets/index.d50a2727.js:20
    H https://myserver.com/assets/index.d50a2727.js:20
    install https://myserver.com/assets/index.d50a2727.js:20
    use https://myserver.com/assets/index.d50a2727.js:1
    <anonymous> https://myserver.com/assets/index.d50a2727.js:71
    InnerModuleEvaluation self-hosted:2411
    evaluation self-hosted:2358

This is local.js

// eslint-disable-next-line no-unused-vars, no-var
var config = {
  name: 'XMPP web',
  transports: {
    websocket: 'wss://myserver.com:5443/ws',
  },
  //hasGuestAccess: true,
  //hasRegisteredAccess: true,
  anonymousHost: null,
  // anonymousHost: 'anon.domain-xmpp.ltd',
  isTransportsUserAllowed: false,
  hasHttpAutoDiscovery: false,
  resource: 'Web XMPP',
  defaultDomain: 'myserver.com',
  defaultMuc: null,
  // defaultMuc: 'conference.domain-xmpp.ltd',
  isStylingDisabled: false,
  hasSendingEnterKey: false,
}

and this is apache conf

<VirtualHost *:443>
  # virtual host identification
  ServerName  myserver.com
  ServerAlias myserver.com
  ServerAdmin admin@myserver.com

  Protocols h2 http/1.1

  DocumentRoot  /var/www/html/xmpp-web

  # ssl
  SSLEngine               on
  Header                  always set Strict-Transport-Security "max-age=15768000"
  SSLStrictSNIVHostCheck  on
  SSLCertificateFile /etc/ssl/private/admin.myserver.com.chained.12.2022.crt
  SSLCertificateKeyFile /etc/ssl/private/admin.myserver.com.12.2022.key

  # websocket proxy
  <IfModule mod_proxy_wstunnel.c>
    <Location "/ws">
      #ProxyPreserveHost On
      ProxyPass "wss://myserver.com:5443/ws"
    </Location>
  </IfModule>

  # front files
  <Directory "/var/www/html/xmpp-web/">
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride None
    Require all granted
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase   /
      RewriteRule   ^index\.html$ - [L]
      RewriteCond   %{REQUEST_FILENAME} !-f
      RewriteCond   %{REQUEST_FILENAME} !-d
      RewriteRule   . /index.html [L]
    </IfModule>
  </Directory>

  # logs
  ErrorLog  ${APACHE_LOG_DIR}/chat_error.log
  LogLevel      warn
  CustomLog ${APACHE_LOG_DIR}/chat_access.log vhost_combined
</VirtualHost>

I'm trying to use my wildcard ssl cert. Can I use my ssl cert with xmpp-web docker?

nioc commented 2 years ago

Thanks for this detailled report. If you have a blank screen before login, it is not an xmpp issue. I'll test your apache configuration tonight.

Using docker, I suggest to use a network front component (haproxy is very good at it) for handling ssl, cache, load balancing. Otherwise, you can use your cert with this image by passing it as mount (you also need to bind the nginx configuration file). I have an example on my laptop, I'll send it to you tonight.

nioc commented 2 years ago

@vladosam I am confused about something, why did you commented theses 2 attributes?

Do not comment or set to false both attributes, otherwise, routing crashes (as you have experienced).

vladosam commented 2 years ago

You where right. I don't know why i commented out those two lines. I probably wanted to comment out hasGuestAccess but I accidentally commented out hasRegisteredAccess also. Everything works now. Thanks. Closing this.