Onlyoffice via subdomain only displays blank page

Hi,

I’m trying to get Onlyoffice integration working with Seafile CE 6.2.5, however it only displays blank page when I try to open .doc files.
Onlyoffice is installed via subdomain and I get the welcome page on https://onlyoffice.myseafiledomain.com/welcome

This is in my seahub_settings.py:

ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = True   # comment: I also tried with False, no change
ONLYOFFICE_APIJS_URL = 'https://onlyoffice.myseafiledomain.com/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

But there is only blank page showing up when I click on .doc or .docx files.
Page source shows:

<head>
<title>seafile-tutorial.doc</title>
<link rel="icon" href="/media/img/favicon.ico" />
<style type="text/css">
html, body { padding:0; margin:0; }
</style>
</head>
<div id="placeholder"></div>
<script type="text/javascript" src="https://onlyoffice.myseafiledomain.com/web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript">
var config = {
    "document": {
        "fileType": "doc",
        "key": "7f01b8831e68e2357f3c",
        "title": "seafile-tutorial.doc",
        "url": "https://seafile.myseafiledomain.com/seafhttp/files/fcecfa05-72c3-4231-98c9-3d53a9092425/seafile-tutorial.doc",
        "permissions": {
            "download": true,
            "edit": false,
            "print": true,
            "review": true
        },
    },
    "documentType": "text", // 'text' | 'spreadsheet' | 'presentation',
    "editorConfig": {
        "callbackUrl": "https://seafile.myseafiledomain.com/onlyoffice/editor-callback/",
        "lang": "de",
        "mode": "view",
        "user": {
            "name": "My Name"
        }
    },
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);
</script>

I’m using Apache and the server is running behind a HAProxy load balancer which might be related to the problem, unfortunately I have no idea what the problem might be.

Maybe anyone else can help?

Thanks,
Matt

I just used Chrome Dev console and this is the error I get:

api.js:374 Mixed Content: The page at ‘https://seafile.myseafiledomain.com/lib/7dcea43a-27ee-45ce-89ad-4c7529a5da26/file/Vereinbarung_34.docx’ was loaded over HTTPS, but requested an insecure resource ‘http://onlyoffice.myseafiledomain.com/2018-01-11-13-33/web-apps/apps/documenteditor/main/index.html?_dc=2018-01-11-13-33&lang=de&customer=ONLYOFFICE&frameEditorId=placeholder’. This request has been blocked; the content must be served over HTTPS.

It is trying to load from http://onlyoffice… instead of https://onlyoffice… which seems to cause the problem. Any idea how to fix this?

Is this domain available and configured for SSL use?

I have a HAProxy loadbalancer server in front of the seafile server. The seafile server is running Apache on port 80, while the HAProxy does SSL handling.

This is what I have in haproxy.cfg:

frontend http-in
        bind :80
        bind *:443 ssl crt /etc/ssl/seafile.myseafiledomain.com/seafile.myseafiledomain.com.pem

        # Redirect if HTTPS is *not* used
        redirect scheme https code 301 if !{ ssl_fc }

        acl seafile hdr_beg(host) -i seafile.myseafiledomain.com
        acl onlyoffice hdr_beg(host) -i onlyoffice.myseafiledomain.com

        use_backend sf if seafile
        use_backend oo if onlyoffice

backend sf
        server node2 10.10.10.3:80 check

backend oo
        server node3 10.10.10.3:8090 check

10.10.10.3 is IP of my seafile server and it is listening on port 80 for seafile requests and port 8090 is used for onlyoffice running in a docker container on same server with

sudo docker run -i -t -d -p 8090:80 --restart=always --name oods onlyoffice/documentserver`

Configure self signed certs internally and use SSL internally. Then try again.
Seems a redirect problem for me. Haproxy allows redirects?

In haproxy.cfg I disabled forwarding to SSL port 443 and tested again without SSL and then it works, Onlyoffice shows up and I can edit the file.
But of course I need to get it working with SSL… just need to figure out what exactly the problem is and how to fix it.

Looks like I get it working adding just one setting to haproxy.cfg for the backend oo:

backend oo
        http-request add-header X-Forwarded-Proto https if { ssl_fc }
        server node3 10.10.10.3:8090 check

I found the solution on this web site: https://helpcenter.onlyoffice.com/server/document/document-server-proxy.aspx

2 Likes