Try the fastest and simplest way to install ONLYOFFICE

[SOLVED] teaching documentserver the external url

IIS, Apache

[SOLVED] teaching documentserver the external url

Postby FROGGS » Sat Feb 25, 2017 5:56 pm

Hi, I have installed the ONLYOFFICE™ Integration Edition as a docker container.

The documentserver (docker container) is listening on port 80.
The example ist working fine, so I tried setting my scenario:

https://localhost:3000 is serving my web application, including this shortened html:
Code: Select all
<!DOCTYPE html>
<html>
    <head>
        <script src="/onlyoffice/web-apps/apps/api/documents/api.js"></script>
    </head>
    <body>
        <div id="placeholder"></div>
        <script>
            var config = {
                "document": {
                    "fileType": "docx",
                    "key": "Khirz6zTPdfd7",
                    "title": "Example Document Title.docx",
                    "url": "http://example.com/url-to-example-document.docx",
                },
                "documentType": "text",
                "editorConfig": {
                    "callbackUrl": "http://example.com/url-to-callback.ashx",
                },
                "type": "embedded",
            };
            var docEditor = new DocsAPI.DocEditor("placeholder", config);
        </script>
    </body>
</html>


My web application redirects /onlyoffice to http://127.0.0.1 as a reverse proxy.

I can fetch https://localhost:3000/onlyoffice/web-apps/apps/api/documents/api.js just fine, it gets correctly reverse proxed to the docker container.

But what happens when I load the page in broser is this:
GET https://localhost:3000/only-office/web-apps/apps/documenteditor/embed/index.html?_dc=2017-02-17-15-22&lang=en&customer=ONLYOFFICE&frameEditorId=placeholder
302 Location http://127.0.0.1/2017-02-17-15-22/web-apps/apps/documenteditor/embed/index.html?_dc=2017-02-17-15-22&lang=en&customer=ONLYOFFICE&frameEditorId=placeholder

This of course is a problem because:
- it tries to do http instead of https
- it tries to connect to a different server

For security reasons I want the requests go to my own web app only.
How can I tell onlyoffice to use https://localhost:3000/only-office as the base url?
Last edited by FROGGS on Mon Feb 27, 2017 7:06 pm, edited 1 time in total.
FROGGS
 
Posts: 2
Joined: Sat Feb 25, 2017 5:35 pm

Re: teaching documentserver the external url

Postby Maxim » Mon Feb 27, 2017 10:08 am

Hello FROGGS!
Here you can find some examples of configs for proxy. I hope it will help you.
When traffic proxying you should add to header
Code: Select all
X-Forwarded-Host <server_name>[/virtual_path]
X-Forwarded-Proto <protocol>

where <server_name> is address of your proxy server, virtual_path is virtual directory where DS will be accessible, protocol is for http|https.
In your case virtual_path is going to be onlyoffice i suppose.
Maxim
 
Posts: 778
Joined: Tue Oct 11, 2016 2:34 pm

Re: teaching documentserver the external url

Postby FROGGS » Mon Feb 27, 2017 7:05 pm

Awesome, that does it! Thank you very much!

PS: For those interested I'm using a Perl Mojolicious server, and I'm adding this to the ReverseProxy plugin:
Code: Select all
$req->headers->header('X-Forwarded-Host',  'localhost:3000/onlyoffice');
$req->headers->header('X-Forwarded-Proto', 'https');
FROGGS
 
Posts: 2
Joined: Sat Feb 25, 2017 5:35 pm

Re: [SOLVED] teaching documentserver the external url

Postby Maxim » Tue Feb 28, 2017 7:34 am

Hello FROGGS!
It's good to hear it.
Maxim
 
Posts: 778
Joined: Tue Oct 11, 2016 2:34 pm


Return to Web server configuration

Who is online

Users browsing this forum: No registered users and 1 guest

cron