CollaboraOnline / richdocumentscode

Built-in CODE Server app
https://apps.nextcloud.com/apps/richdocumentscode
Apache License 2.0
116 stars 27 forks source link

Could not find urlsrc in WOPI #119

Open chrissooo opened 3 years ago

chrissooo commented 3 years ago

Hi,

have Update to 6.4.705 an have a error when try to open a document:

I am on a CentOS 7 installation, PHP 8 and Apache. No Docker Image.

[richdocuments] Error: Exception: Could not find urlsrc in WOPI at <<closure>>

0. ******/apps/richdocuments/lib/TokenManager.php line 217
   OCA\Richdocuments\WOPI\Parser->getUrlSrc("application/vnd ... t")
1. ******/apps/richdocuments/lib/Controller/DocumentController.php line 256
   OCA\Richdocuments\TokenManager->getToken("*** sensitive parameters replaced ***")
2. ******/lib/private/AppFramework/Http/Dispatcher.php line 218
   OCA\Richdocuments\Controller\DocumentController->index("*** sensitive parameter replaced ***", null)
3. ******/lib/private/AppFramework/Http/Dispatcher.php line 127
   OC\AppFramework\Http\Dispatcher->executeController(OCA\Richdocument ... {}, "index")
4. ******/lib/private/AppFramework/App.php line 157
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Richdocument ... {}, "index")
5. ******/lib/private/Route/Router.php line 302
   OC\AppFramework\App::main("OCA\\Richdocume ... r", "index", OC\AppFramework\ ... {}, {_route: "richdocuments.document.index"})
6. ******/lib/base.php line 993
   OC\Route\Router->match("/apps/richdocuments/index")
7. ******/index.php line 37
   OC::handleRequest()

GET /apps/richdocuments/index?fileId=19121&requesttoken=jRd3y0CoWLcTBxakWricr3nu%2FiSZLT0S23weF5TaFSY%3D%3Apjg2nBfyKJhqdlXDIt391S2evFb%2FGFRrlTRpb9uLbVU%3D

Manual Downgrade to 6.4.608 Fixed it.

timar commented 3 years ago

https://github.com/nextcloud/richdocuments/issues/1442 is related.

chrissooo commented 3 years ago

Hi, you are right ... after waiting a while, now its work ... maybe cache or something?

chrissooo commented 3 years ago

Hi again,

today not working again. Nothing changed since yesterday. Same Error like in first post.

chrissooo commented 3 years ago

Just install 6.4.608 again, no problems anymore.

timar commented 3 years ago

I have a feeling that it has nothing to do with richdocumentscode.

frezeen commented 3 years ago

fresh install, x86 pc, debian 64 bit, docker image, same problem

ppascher commented 3 years ago

I also ran into this issue on nextcloud 20.0.8 ("Could not find urlsrc in WOPI"). At first I tried downgrading Collabora Online - Built-in CODE Server from 6.4.705 down to 6.4.608 release by release but Collabora Online was not working. Next I upgraded the CODE Server back to 6.4.705 and tried downgrading Collabora Online from version 3.7.17. And right away version 3.7.16 was working again.

chrissooo commented 3 years ago

Collabora Online 4.0.4, Collabora Online - Built-in CODE Server 6.4.608 on Nexcloud 21 work without problems

chrissooo commented 3 years ago

Have test a another constalation: Collabora Online 4.0.3 an Built-in CODE Server 6.4.705 work also...

chrissooo commented 3 years ago

Hi again, sorry for this mutch reporting, but the constalation "Collabora Online 4.0.3 an Built-in CODE Server 6.4.705" dont work today anymore. The only one konstalation thats work for longer time ist for me: "Collabora Online 4.0.4, Collabora Online - Built-in CODE Server 6.4.608"

dsysvdu commented 3 years ago

Hi,

Same issue here, running Nextcloud 20.0.7 (latest snap available), made the mistake of upgrading Collabora Online to 3.7.17 and Built-in CODE Server to 6.4.705, and getting the same issue as the original post.

Not a critical issue as it's a test of Nextcloud used only by 2 persons, but still pretty annoying :/

@ppascher : I'm pretty new to NC, how did you downgrade to Collabora Online to 3.7.16 version ? Manual deployment from zip ? Cross-restore of a VM backup and manual copy of needed files ?

FMeinicke commented 3 years ago

@dsysvdu I was wondering the same thing and basically tried what you proposed. Here are the steps:

  1. Change into the custom_apps folder that is located right below the root folder of your Nextcloud installation
  2. Download the previous version of Collabora from here https://github.com/nextcloud/richdocuments/releases/download/v3.7.16/richdocuments.tar.gz using wget for example
  3. un-tar what you just downloaded: tar -xzf richdocuments.tar.gz -C .
  4. then change into the root directory of your NC installation and run ./occ app:enable richdocuments as www-data user (i.e. you might need to prefix the previous command with sudo -u www-data

Now in the admin web UI of your Nextcloud server, you should see Collabora showing up as an available app update and when you try to open a document it should be working again. At least it did work for me :wink:

dsysvdu commented 3 years ago

@FMeinicke Thank you very much for this detailed procedure, I'm sure that it will help many :)

I'll try this in the coming days and edit this post to tell the result (but I'm confident it will work)

dspoel commented 3 years ago

@FMeinicke thanks for the instruction. Unfortunately NextCloud insist on autoupdating, but even without that a downgrade did not seem to help in my case. More tips appreciated!

Styrone commented 3 years ago

Hi. Nextcloud snap 20.0.9 / Collabora Online 3.7.19 / CODE 6.4.705. Ubuntu 20.04 Fresh install Same pb...

cheesgno commented 3 years ago

@FMeinicke Thank you very much I tried your solution on my Nextcloud V21.0.1 both with downgraded versions of collabora V3 (not compatible) and V4. Unfortunately the problem persist again

yewkay commented 3 years ago

I got the same error, running Nextcloud 21.0.2 Collabora Online v4.1.1 Collabora Online - Built-in CODE Server v6.4.806

installed the 2 app within NC, didn't work.

JamesDAdams commented 3 years ago

same

tt33tt commented 3 years ago

I have received the message mod_fcgid: stderr: richdocumentscode (proxy.php) error exit, PID: 212444, Message: exec_disabled

Is it neccessary that I activate the function exec that it is working?

martinr63 commented 3 years ago

I've the same problem on a fresh install on centos. When I disable selinux (setenforce 0) it is working

MagnusWestin commented 3 years ago

Can confirm that solves the problem for me also on Fedora 33 Server and running NextCloud 21.0.3.

neoacevedo commented 3 years ago

Not for me. By default selinux in my case is disabled, and today I have updated Collabora to 4.2.1.

anpct commented 3 years ago

Getting the same issue using NC22, Collabora Online - Built-in CODE Server (6.4.1004), Collabora Online (4.2.1)

Exception: Could not find urlsrc in WOPI

NeoThomasAAnderson commented 3 years ago

Same issue here (NC 21.0.3, CO 4.2.1, CODE 6.4.1004): "Collabora Online server is reachable." but when opening a document, I always receive this message: "Failed to load Collabora Online - please try again later". Logging reports "Exception: Could not find urlsrc in WOPI". Had a lot of different combinations installed, but never got it working ... Tried with a docker collabora/code on DSM7, but this one was not able to get connected to it :-(

fuzunspm commented 3 years ago

same problem Exception: Could not find urlsrc in WOPI

MagnusWestin commented 3 years ago

Update: never mind, after restarting and having SeLinux off, it started working again...

turning off selinux no longer works for me and "Exception: Could not find urlsrc in WOPI" is back again after I updated the app.

martinr63 commented 3 years ago

On my installation there was 2 Problems. One was selinux. I had to set own rules with ausearch -c 'AppRun' --raw | audit2allow -M my-AppRun

After updating nextcloud and the apps, I got the same error message and in my Browser Console there was

Refused to send form data to 'http://nextcloud.*****.de/apps/richdocumentscode/proxy.php?req=/loleaflet/2afbc52/loleaflet.html?WOPISrc=https%3A%2F%2Fnextcloud.******.de%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F3248_ocyhdvybdxcf&title=*******.ods&lang=de&closebutton=1&revisionhistory=1' because it violates the following Content Security Policy directive: "form-action 'self'

This problem was caused from my reverse proxy not sending all X-Forwarded Header to the nextcloud server.

fschrempf commented 2 years ago

This problem was caused from my reverse proxy not sending all X-Forwarded Header to the nextcloud server.

Would you mind sharing what exactly you have changed in your proxy config? I'm suspecting that I have the same problem, but it's quite hard to reproduce (only some users see it).

Verhoeckx commented 2 years ago

This problem was caused from my reverse proxy not sending all X-Forwarded Header to the nextcloud server.

I'm also very curious what you did because I have the exact same problem!

martinr63 commented 2 years ago

Would you mind sharing what exactly you have changed in your proxy config? I'm suspecting that I have the same problem, but it's quite hard to reproduce (only some users see it).

Here my settings (Apache/2.4). The important thing was the line with 'RequestHeader'

<VirtualHost *:443>
ServerName nextcloud.xxxxx.de:443

ProxyRequests Off
ProxyPreserveHost On

ProxyPass "/" "http://192.168.111.222/"
ProxyPassReverse "/" "http://192.168.111.222/"

RequestHeader set X-Forwarded-Proto https
Verhoeckx commented 2 years ago

@martinr63: thank you very much for your reply!

What was the reason that you thought it also had something to due with SELinux? Did you get AVC denial messages?

I added the directive RequestHeader set X-Forwarded-Proto https but it didn't have any effect. When I look in /var/log/audit/audit.log or /var/log/messages I don't see any AVC denial messages.

martinr63 commented 2 years ago

What was the reason that you thought is also had something to due with SELinux?

I got tons of AVC denial messages in journalctl after installing setroubleshoot. Then I disabled selinux temporally, edited a document and did a ausearch | audit2allow

TheDrCrow commented 2 years ago

Same issue for me. Ubuntu Core 18 on Intel Nuc with NC, run as an appliance. Nextcloud snap 22.1.1snap2 Collabora online 4.2.3 Collabora CODE server 6.4.1103.

I think re-installing older versions is not a realistic option on this set up.

Verhoeckx commented 2 years ago

I'm trying to solve this problem here but I haven't succeeded yet.

fschrempf commented 2 years ago

Here my settings (Apache/2.4). The important thing was the line with 'RequestHeader'

Thanks @martinr63! I'm using nginx-proxy which already has RequestHeader set X-Forwarded-Proto https in place. So the issue must be elsewhere.

sharmankin commented 2 years ago

Faced this problem when using Colabora online, Colabora online simply did not open documents and writing to the logs:

{
    "reqId": "YYw1753eVu93R4XFJoPuBgAAAE0",
    "level": 3,
    "time": "2021-11-10T21:13:21+00:00",
    "remoteAddr": "**************",
    "user": "*********",
    "app": "richdocuments",
    "method": "GET",
    "url": "/index.php/apps/richdocuments/index?fileId=623652&requesttoken=8Xx%2FfJDIA27PkhonYID60rPpIxReqkYoIbnsmiJgF4c%3D%3AxRsaV%2FKyYQWm4GtlN%2FiyneCaSUIbxjJSb8672GAOZs8%3D",
    "message": "Could not find urlsrc in WOPI",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0",
    "version": "22.2.0.2",
    "exception": {
        "Exception": "Exception",
        "Message": "Could not find urlsrc in WOPI",
        "Code": 0,
        "Trace": [{
                "file": "/var/www/nextcloud/apps/richdocuments/lib/TokenManager.php",
                "line": 202,
                "function": "getUrlSrc",
                "class": "OCA\\Richdocuments\\WOPI\\Parser",
                "type": "->"
            }, {
                "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/DocumentController.php",
                "line": 222,
                "function": "getToken",
                "class": "OCA\\Richdocuments\\TokenManager",
                "type": "->",
                "args": ["*** sensitive parameters replaced ***"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 217,
                "function": "index",
                "class": "OCA\\Richdocuments\\Controller\\DocumentController",
                "type": "->"
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 126,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->"
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
                "line": 156,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->"
            }, {
                "file": "/var/www/nextcloud/lib/private/Route/Router.php",
                "line": 301,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::"
            }, {
                "file": "/var/www/nextcloud/lib/base.php",
                "line": 1000,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->"
            }, {
                "file": "/var/www/nextcloud/index.php",
                "line": 36,
                "function": "handleRequest",
                "class": "OC",
                "type": "::"
            }
        ],
        "File": "/var/www/nextcloud/apps/richdocuments/lib/WOPI/Parser.php",
        "Line": 59,
        "CustomMessage": "--"
    },
    "id": "618c41d2c7294"
}

The problem was solved by restarting memcached (sudo systemctl restart memcached)

Verhoeckx commented 2 years ago

I solved the problem and you can find my solution in this issue.

Summary:

  1. I had to add RequestHeader set X-Forwarded-Proto https to my virtual host.
  2. Had to fix two SELinux issues.
Flowdalic commented 2 years ago

In my case the problem was that the Collabora_Online.AppImage could not be started. I found this out by checking the apps/richdocumentscode/proxy.php?status URL.

baderdean commented 2 years ago

Hello, when using a snap of nextcloud, we could not normally change the config files. So how to make it work?

KLEPTOROTH commented 2 years ago

Hello, when using a snap of nextcloud, we could not normally change the config files. So how to make it work?

I have the same question.

estebanlm commented 2 years ago

hi, I am also experimenting this problem. Is there a way to fix it when using the snap ?

Verhoeckx commented 2 years ago

Which Linux distribution are you using?

I used RHEL and you can find my solution here.

fschrempf commented 2 years ago

In my case I have a docker-based setup and no SELinux. The issue still occurs sometimes. Sometimes it works fine, though.

estebanlm commented 2 years ago

Which Linux distribution are you using?

Ubuntu server 20.04. But my problem is I am using the snap and I have no idea how to modify it to modify the configuration there.

Verhoeckx commented 2 years ago

Maybe you can ask the question at the forum of Snapcraft?

estebanlm commented 2 years ago

To answer my own question, with the snap it is enough to add @Verhoeckx's solution at the .htaccess file, at /var/snap/nextcloud/current/nextcloud/config :)

Verhoeckx commented 2 years ago

You mean you added the line RequestHeader set X-Forwarded-Proto https to the .htaccess file?

estebanlm commented 2 years ago

yes, I made that and I got it working on nextcloud-snap :)

fpennica commented 2 years ago

yes, I made that and I got it working on nextcloud-snap :)

Does not work for me... where exactly should the line be added?

This is my /var/snap/nextcloud/current/nextcloud/config/.htaccess file:

# Section for Apache 2.4 to 2.6
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>
<IfModule mod_access_compat.c>
  Order Allow,Deny
  Deny from all
  Satisfy All
</IfModule>

# Section for Apache 2.2
<IfModule !mod_authz_core.c>
  <IfModule !mod_access_compat.c>
    <IfModule mod_authz_host.c>
      Order Allow,Deny
      Deny from all
    </IfModule>
    Satisfy All
  </IfModule>
</IfModule>

# Section for Apache 2.2 to 2.6
<IfModule mod_autoindex.c>
  IndexIgnore *
</IfModule>
estebanlm commented 2 years ago

this is mine, and it works for me:

# Section for Apache 2.4 to 2.6
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>
<IfModule mod_access_compat.c>
  Order Allow,Deny
  Deny from all
  Satisfy All
</IfModule>

# Section for Apache 2.2
<IfModule !mod_authz_core.c>
  <IfModule !mod_access_compat.c>
    <IfModule mod_authz_host.c>
      Order Allow,Deny
      Deny from all
    </IfModule>
    Satisfy All
  </IfModule>
</IfModule>

# Section for Apache 2.2 to 2.6
<IfModule mod_autoindex.c>
  IndexIgnore *
</IfModule>

RequestHeader set X-Forwarded-Proto https