nextcloud / richdocuments

📑 Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
349 stars 115 forks source link

APP generates wrong URL #1497

Closed msi-tl closed 9 months ago

msi-tl commented 3 years ago

Describe the bug Since Nextcloud APP version 3.7.19 (NC 20.0.9 and 20.8.1) in combination with Collabora Online - Built-in CODE Server 6.4.705 it's not possible to open documents over a public domain. The richdocuments app generates a URL for the local address of the server.

To Reproduce Steps to reproduce the behavior:

  1. Install NC 20.0.9 with Collabora Online v 3.7.19 and Collabora Online - Built-in CODE Server 6.4.705
  2. Create or open a file (don't care if a document, table or presentation)
  3. The document doesn't open -> F12 tools show a url with local ip instead of the FQND
  4. Additional read value of public_wopi_url from cli -> /occ config:app:get richdocuments public_wopi_url
  5. See the variable with local IP instead of FQND. "wopi_url" has the FQND.

Expected behavior The public_wopi_url should have the FQND instead of the local IP of the server. Documents should open propertly.

Screenshots If applicable, add screenshots to help explain your problem. grafik

Client details:

Server details

Operating system: Ubuntu 20.04.2 LTS

Web server: Apache

Database: Mysql 8

PHP version: 7.4

Nextcloud version: 20.9

Version of the richdocuments app 3.7.19

Version of Collabora Online 6.4.705

juliushaertl commented 2 years ago

Can you tell how you installed the richdocumentscode app in the beginning? Was it through CLI? Do you have an overwrite.cli.url set in your config.php?

BornToBeRoot commented 2 years ago

Hi @juliushaertl,

i can reproduce the bug.

My setup:

image

This is my docker-compose running on a docker server:

version: '3.7'

services:
  # Database
  mariadb:
    image: mariadb:latest
    container_name: nextcloud_test_db
    command: --transaction-isolation=READ-COMMITTED --log-bin=ROW --innodb_read_only_compressed=OFF
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - ./data/nextcloud-db:/var/lib/mysql
    restart: unless-stopped
    environment:
      - TZ=UTC
      - MYSQL_INITDB_SKIP_TZINFO=1
    env_file:
      - mariadbadmin.env
      - mariadb.env

  # Redis
  redis:
    image: redis:alpine
    container_name: nextcloud_test_redis
    restart: unless-stopped
    volumes:
      - ./data/nextcloud-redis:/var/lib/redis
    command: redis-server --requirepass TEST

  # Nextcloud Web
  nextcloud:
    depends_on:
      - redis
      - mariadb
    image: nextcloud:stable-apache
    container_name: nextcloud_test
    volumes:
      - ./data/nextcloud-www:/var/www/html
      - ./data/nextcloud-data:/mnt/nextcloud-data
    networks:
      - default
      - traefik_proxy
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nextcloud-test.rule=Host(`cloud-test.internal.example.com`)"
      - "traefik.http.routers.nextcloud-test.entrypoints=websecure"
      - "traefik.http.routers.nextcloud-test.tls.certresolver=dnschallenge"
      - "traefik.http.routers.nextcloud-test.tls=true"
      - "traefik.http.routers.nextcloud-test.service=nextcloud-test"
      - "traefik.http.services.nextcloud-test.loadbalancer.server.port=80"
      - "traefik.http.routers.nextcloud-test.middlewares=nextcloud-test-dav"
      - "traefik.http.middlewares.nextcloud-test-dav.replacepathregex.regex=^/.well-known/ca(l|rd)dav"
      - "traefik.http.middlewares.nextcloud-test-dav.replacepathregex.replacement=/remote.php/dav/"
      - "traefik.docker.network=traefik_proxy"
    environment:
      REDIS_HOST: redis
      REDIS_HOST_PASSWORD: TEST
      MYSQL_HOST: mariadb      
      NEXTCLOUD_DATA_DIR: /mnt/nextcloud-data
      NEXTCLOUD_TRUSTED_DOMAINS: cloud-test.internal.example.com
      TRUSTED_PROXIES: traefik
      OVERWRITEHOST: cloud-test.example.com
      OVERWRITEPROTOCOL: https      
    env_file:
      - mariadb.env
      - smtp.env

    # Nextcloud cron
  cron:
    depends_on:
      - mariadb
      - redis
    image: nextcloud:stable-apache
    container_name: nextcloud_test_cron
    restart: unless-stopped
    volumes:
      - ./data/nextcloud-www:/var/www/html
      - ./data/nextcloud-data:/mnt/nextcloud-data
    entrypoint: /cron.sh

networks:
  traefik_proxy:
    external:
      name: traefik_proxy

In the config.php i changed 'overwrite.cli.url' => 'https://cloud-test.example.com',

This is the config for the app richdocumentscode:

php occ config:app:get richdocuments wopi_url is set to: https://cloud-test.example.com/custom_apps/richdocumentscode/proxy.php?req= and php occ config:app:get richdocuments public_wopi_url is set to https://cloud-test.internal.example.com/custom_apps/richdocumentscode/proxy.php?req=

BornToBeRoot commented 2 years ago

The install is just docker-compose up -d and click next > next in the web ui.

joshtrichards commented 10 months ago

Did you initially setup/install richdocumentscode + richdocuments while connected via http:// by chance?

What happens if you either change the wopi_url/public_wopi_url from the command-line or change/re-save settings under Admin settings->Office?

The public_wopi_url gets populated I think from the Capabilities returned via `https:////richdocumentscode/proxy.php?req=/hosting/discovery

Though there could be other possibilities too.