richdocuments icon indicating copy to clipboard operation
richdocuments copied to clipboard

APP generates wrong URL

Open msi-tl opened this issue 3 years ago • 3 comments

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:

  • OS: Linux Mint 20.1
  • Browser Firefox, Chrome, Chromium
  • Version 87.0, 90.0.4430.72, 89.0.4389.128
  • Device: Desktop

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

msi-tl avatar Apr 20 '21 13:04 msi-tl

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?

juliusknorr avatar Dec 06 '21 21:12 juliusknorr

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 avatar Jan 02 '22 01:01 BornToBeRoot

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

BornToBeRoot avatar Jan 02 '22 01:01 BornToBeRoot

Did you initially setup/install richdocumentscode + richdocuments while connected via http://<ip_address> 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://<domain.tld>/<apps_dir>/richdocumentscode/proxy.php?req=/hosting/discovery

Though there could be other possibilities too.

joshtrichards avatar Nov 16 '23 15:11 joshtrichards