Page 1 of 1

Error 403 when downloading document changes

PostPosted: Mon Jul 02, 2018 2:49 pm
by oguerin
Hello,

We have connected the Document Server (Docker version) with our PHP application through a callback page in PHP. When we try to download document changes from the url given by the document server, we get a 403 error :

Code: Select all
       
        $downloadUri = $data_online["url"];
        $client = new Guzzle\Http\Client();
        $new_data = $client->get($downloadUri)->send()->getBody(true);


Code: Select all
2018-07-02T15:57:19+02:00 DEBUG (7): Client error response
[status code] 403
[reason phrase] Forbidden


If we take the downloadUri (something like https://our.server.com/cache/files/10_9 ... 4wLFakeA==) and paste it in a browser, it works. We get the office document with all changes. But if we try to get it with a curl or wget request, we get a 403 error.

Best regards,
Olivier

Re: Error 403 when downloading document changes

PostPosted: Tue Jul 03, 2018 6:21 am
by Maxim
Hello!
Did you visit our API?

Re: Error 403 when downloading document changes

PostPosted: Tue Jul 03, 2018 8:22 am
by oguerin
Yes, we studied your API basic concepts, implemented the document storage service by following the Opening file section, Saving file section, learned that we have to deal with the Document history management. It works when we use http address, but not when we use https.

Re: Error 403 when downloading document changes

PostPosted: Thu Jul 05, 2018 8:48 am
by Maxim
Hello!
Did you install SSL certs?

Re: Error 403 when downloading document changes

PostPosted: Thu Jul 05, 2018 9:46 am
by oguerin
Hello,

Yes, we genereated the certificates and followed instructions given here : https://helpcenter.onlyoffice.com/fr/server/docker/document/docker-installation.aspx

Code: Select all
$sudo  docker run -i -t -d -p 8443:443 -v /u/apps/onlyoffice/data:/var/www/onlyoffice/Data -v /u/apps/onlyoffice/logs:/var/log/onlyoffice --net=bridge --name onlyoffice --restart=always onlyoffice/documentserver-de
8c906c1477277067cbae70e6e5bfc71877ee3f0e831c453dce627c6e7e9e346b
$ sudo docker logs -f onlyoffice
k * Starting PostgreSQL 9.5 database server                              [ OK ]
 * Starting RabbitMQ Messaging Server rabbitmq-server                    [ OK ]
Starting redis-server: redis-server.
Starting supervisor: supervisord.
 * Starting nginx nginx                                                  [ OK ]
Generating AllFonts.js, please wait...Done
onlyoffice-documentserver:docservice: stopped
onlyoffice-documentserver:docservice: started
onlyoffice-documentserver:converter: stopped
onlyoffice-documentserver:converter: started
 * Reloading nginx configuration nginx       

In /u/apps/onlyoffice/data/certs, we have the following files :
Code: Select all
[centos@test05 ~]$ cd /u/apps/onlyoffice/data/certs
[centos@test05 certs]$ ll
total 12
-rwxr-xr-x 1 110 114  424 13 févr. 15:34 dhparam.pem
-rwxr-xr-x 1 110 114 2171 14 mai   15:46 onlyoffice.crt
-rwxr-xr-x 1 110 114 1704 14 mai   15:46 onlyoffice.key

(we have changed permissions on file onlyoffice.key to 400, but it goes back to 755 every time we launch the container)

Re: Error 403 when downloading document changes

PostPosted: Tue Jul 10, 2018 8:32 am
by oguerin
Hello, do you need more elements for our problem? Are there people having troubles integrating the Docker version of the Document Server in https?

Thanks for your advice.

Re: Error 403 when downloading document changes

PostPosted: Tue Jul 10, 2018 11:16 am
by Maxim
Hello oguerin!
Are there people having troubles integrating the Docker version of the Document Server in https?

No.
https://our.server.com/web-apps/apps/ap ... nts/api.js - do you get API code?

Re: Error 403 when downloading document changes

PostPosted: Tue Jul 10, 2018 3:12 pm
by oguerin
Yes, we get API code :

Image

Re: Error 403 when downloading document changes

PostPosted: Fri Jul 13, 2018 12:52 pm
by oguerin
We have the same error in HTTP mode. We tested using file_get_contents instead of Guzzle and it works, in HTTP or in HTTPS mode.

Thank you for your assistance.