ejabberd가 /http-bind에서 404를 찾을 수 없음을 얻습니다.

ejabberd가 /http-bind에서 404를 찾을 수 없음을 얻습니다.

jsxc/xmpp-cloud-auth와 함께 ejabberd 서버를 사용하여 nextcloud용 외부 xmpp 서버를 설정하는 데 문제가 있습니다.

nextcloud 외부 서버 구성에서 XMPP 도메인 오류가 표시되었습니다.https://cloud.XXX.com:5280 BOSH URL: /http-bind/ 잘못된 XML이 수신되었습니다. 아마도https://cloud.XXX.com/http-bind/리디렉션되었습니다. 절대 URL을 사용해야 합니다.

브라우저를 사용하여 탐색하면 /http-bind에서 404 Not Found가 표시되고, 내 관리 패널도 약간 이상하게 표시되고 모든 것이 표시되지는 않습니다(사진에서 볼 수 있듯이).

나는 다음을 사용하고 있습니다: ubuntu 20.04.1 Apache2 2.4.41 ejabberd 20.12 Nextcloud JavaScript XMPP Chat 4.2.0 xmpp-cloud-auth v2.0.4

이 기사를 사용하여 시스템을 설정했습니다.https://github.com/jsxc/xmpp-cloud-auth/wiki/raspberry-pi-en

왜 이런 일이 발생하는지 아는 사람이 있나요? 404 오류의 원인은 무엇일까요? 누가 http-bind에 답변을 요청합니까? 그리고 원하는 출력은 무엇입니까?

방화벽 설정은 괜찮은 것 같습니다. 로컬에서만 실행되기 때문에 현재 DNS 설정이 설정되어 있지 않습니다. 서버에 호스트 이름 cloud.XXX.com을 제공하는 Windows DNS 서버가 네트워크에서 실행되고 있습니다.

동작을 재현하는 단계

  1. 타자https://cloud.XXX.com:5280/http-bind브라우저에서
  2. 404 오류가 발생함

환경

  • JSXC 버전: JavaScript XMPP 채팅 4.2.0 xmpp-cloud-auth v2.0.4
  • 호스트 시스템 및 버전: Nextcloud 20.0.4 우분투 20.04.1 Apache2 2.4.41
  • 브라우저 공급업체 및 버전: 파이어폭스 84.0.1
  • 브라우저 플러그인이 활성화되어 있나요? 아니요
  • XMPP 서버 공급업체 및 버전: 20.12에 재버드
  • XMPP 서버가 예상대로 다른 클라이언트와 작동하고 있습니까?
    아니요...

apache2 가상 호스트는 다음과 같이 사용자 정의됩니다.

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www

    <FilesMatch ".php$">
        <If "-f %{SCRIPT_FILENAME}">
        SetHandler "proxy:unix:/run/php/php7.4-fpm.nextcloud.sock|fcgi://localhost"
    </If>
    </FilesMatch>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    ProxyPass /http-bind/ http://localhost:5280/http-bind/
    ProxyPassReverse /http-bind/ http://localhost:5280/http-bind/
    ProxyPreserveHost On

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =cloud.XXX.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

내 ejabberd.yml:


---
loglevel: 4
log_rotate_count: 0
log_rotate_date: ""

hosts:
  - "cloud.spacyal.com"

certfiles:
  - "/etc/ejabberd/ejabberd.pem"

## TLS configuration
define_macro:
  'TLS_CIPHERS': "HIGH:!aNULL:!eNULL:!3DES:@STRENGTH"
  'TLS_OPTIONS':
    - "no_sslv3"
    - "no_tlsv1"
    - "no_tlsv1_1"
    - "cipher_server_preference"
    - "no_compression"
    ## 'DH_FILE': "/path/to/dhparams.pem"
    ## generated with: openssl dhparam -out dhparams.pem 2048

c2s_ciphers: 'TLS_CIPHERS'
s2s_ciphers: 'TLS_CIPHERS'
c2s_protocol_options: 'TLS_OPTIONS'
s2s_protocol_options: 'TLS_OPTIONS'
## c2s_dhfile: 'DH_FILE'
## s2s_dhfile: 'DH_FILE'

listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls_required: true
    protocol_options: 'TLS_OPTIONS'
  -
    port: 5223
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    tls: true
    protocol_options: 'TLS_OPTIONS'
  -
    port: 5269
    ip: "::"
    module: ejabberd_s2s_in
    max_stanza_size: 524288
  -
    port: 5443
    ip: "::"
    module: ejabberd_http
    tls: true
    protocol_options: 'TLS_OPTIONS'
    request_handlers:
      /api: mod_http_api
      /bosh: mod_bosh
      ## /captcha: ejabberd_captcha
      ## /upload: mod_http_upload
      /ws: ejabberd_http_ws
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    tls: true
    protocol_options: 'TLS_OPTIONS'
    request_handlers:
      /admin: ejabberd_web_admin
      /.well-known/acme-challenge: ejabberd_acme
  -
    port: 1883
    ip: "::"
    module: mod_mqtt
    backlog: 1000


## Disabling digest-md5 SASL authentication. digest-md5 requires plain-text
## password storage (see auth_password_format option).
disable_sasl_mechanisms:
  - "digest-md5"
  - "X-OAUTH2"

s2s_use_starttls: required

## Store the plain passwords or hashed for SCRAM:
auth_password_format: scram
auth_method: external
extauth_program: "/usr/bin/socket localhost 23662"
auth_use_cache: false
## Full path to a script that generates the image.
## captcha_cmd: "/usr/share/ejabberd/captcha.sh"

acl:
  admin:
     user:
       - "admin"

  local:
    user_regexp: ""
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128

access_rules:
  local:
    allow: local
  c2s:
    deny: blocked
    allow: all
  announce:
    allow: admin
  configure:
    allow: admin
  muc_create:
    allow: local
  pubsub_createnode:
    allow: local
  trusted_network:
    allow: loopback

api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who:
      access:
        allow:
          acl: loopback
          acl: admin
      oauth:
        scope: "ejabberd:admin"
        access:
          allow:
            acl: loopback
            acl: admin
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who:
      ip: 127.0.0.1/8
    what:
      - status
      - connected_users_number

shaper:
  normal: 1000
  fast: 50000

shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    5000: admin
    100: all
  c2s_shaper:
    none: admin
    normal: all
  s2s_shaper: fast

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {}
  ## mod_delegation: {}   # for xep0356
  mod_disco: {}
  mod_echo: {}
  mod_fail2ban: {}
  mod_http_api: {}
  ## mod_http_upload:
  ##   put_url: https://@HOST@:5443/upload
  mod_last: {}
  ## mod_mam:
  ##   ## Mnesia is limited to 2GB, better to use an SQL backend
  ##   ## For small servers SQLite is a good fit and is very easy
  ##   ## to configure. Uncomment this when you have SQL configured:
  ##   ## db_type: sql
  ##   assume_mam_usage: true
  ##   default: always
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      mam: true
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_pres_counter:
    count: 5
    interval: 60
  mod_privacy: {}
  mod_private: {}
  mod_proxy65:
    access: local
    max_connections: 5
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      "eu.siacs.conversations.axolotl.*":
        access_model: open
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  ## mod_register:
  ##   ## Only accept registration requests from the "trusted"
  ##   ## network (see access_rules section above).
  ##   ## Think twice before enabling registration from any
  ##   ## address. See the Jabber SPAM Manifesto for details:
  ##   ## https://github.com/ge0rg/jabber-spam-fighting-manifesto
  ##   ip_access: trusted_network
  mod_roster:
    versioning: true
  mod_s2s_dialback: {}
  mod_shared_roster: {}
  mod_sic: {}
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_vcard:
    search: false
  mod_vcard_xupdate: {}
  mod_version: {}

ejabberd.log 내용:

2020-12-25 22:03:38.847 [notice] <0.128.0>@lager_file_backend:154 Changed loghwm of /var/log/ejabberd/error.log to 100
2020-12-25 22:03:38.847 [notice] <0.128.0>@lager_file_backend:154 Changed loghwm of /var/log/ejabberd/ejabberd.log to 100
2020-12-25 22:03:38.908 [info] <0.114.0>@ejabberd_config:load:80 Loading configuration from /etc/ejabberd/ejabberd.yml
2020-12-25 22:03:38.919 [warning] <0.114.0>@ejabberd_config_transformer:warn_removed_module:514 Module mod_echo is deprecated and was automatically removed from the configuration. Please adjust your configuration file accordingly. Hint: run `ejabberdctl dump-config` command to view current configuration as it is seen by ejabberd.
2020-12-25 22:03:39.010 [warning] <0.114.0>@gen_mod:warn_soft_dep_fail:576 Module mod_mam is recommended for module mod_muc but is not found in the config
2020-12-25 22:03:39.023 [info] <0.114.0>@ejabberd_config:load:87 Configuration loaded successfully
2020-12-25 22:03:39.262 [info] <0.359.0>@gen_mod:start_modules:124 Loading modules for cloud.spacyal.com
2020-12-25 22:03:39.431 [info] <0.473.0>@mod_mqtt:init_topic_cache:523 Building MQTT cache for cloud.spacyal.com, this may take a while
2020-12-25 22:03:39.490 [info] <0.114.0>@ejabberd_cluster_mnesia:wait_for_sync:123 Waiting for Mnesia synchronization to complete
2020-12-25 22:03:39.629 [info] <0.114.0>@ejabberd_app:start:62 ejabberd 20.01-1 is started in the node ejabberd@localhost in 0.91s
2020-12-25 22:03:39.629 [info] <0.380.0>@ejabberd_listener:init:151 Start accepting TCP connections at [::]:5222 for ejabberd_c2s
2020-12-25 22:03:39.629 [info] <0.381.0>@ejabberd_listener:init:151 Start accepting TLS connections at [::]:5223 for ejabberd_c2s
2020-12-25 22:03:39.629 [info] <0.382.0>@ejabberd_listener:init:151 Start accepting TCP connections at [::]:5269 for ejabberd_s2s_in
2020-12-25 22:03:39.631 [info] <0.383.0>@ejabberd_listener:init:151 Start accepting TLS connections at [::]:5443 for ejabberd_http
2020-12-25 22:03:39.631 [info] <0.384.0>@ejabberd_listener:init:151 Start accepting TLS connections at [::]:5280 for ejabberd_http
2020-12-25 22:03:39.632 [info] <0.385.0>@ejabberd_listener:init:151 Start accepting TCP connections at [::]:1883 for mod_mqtt
2020-12-25 22:03:39.632 [info] <0.477.0>@ejabberd_listener:init:151 Start accepting TCP connections at 10.0.0.4:7777 for mod_proxy65_stream
2020-12-25 22:03:59.226 [info] <0.384.0>@ejabberd_listener:accept:256 (<0.531.0>) Accepted connection [::ffff:10.0.0.3]:60338 -> [::ffff:10.0.0.4]:5280

어떤 아이디어?? 나는 매우 감사하게 될 것입니다! 이틀째 노력했는데 해결이 안되네요

정말 고마워 !!

그리고 메리 크리스마스 :-)

답변1

구성 방법을 확인하세요. ejabberd에게 path 를 수신하도록 지시하는 경우 /bosh해당 URL을 사용해야 합니다. 예를 들어:

listen:
  ...
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    tls: false
    request_handlers:
      /bosh: mod_bosh
  -
    port: 5443
    ip: "::"
    module: ejabberd_http
    tls: true
    request_handlers:
      /bosh: mod_bosh

이것은 작동합니다:

$ curl http://localhost:5280/bosh/
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'><head><title>ejabberd mod_bosh</title><style>body {
...

$ curl -k https://localhost:5443/bosh/
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'><head><title>ejabberd mod_bosh</title><style>body {
...

관련 정보