# Opening office documents sometimes fails

**URL:** <https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941>\
**Category:** Installation & Configuration\
**Created:** [September 3, 2024, 7:44am UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941 "2024-09-03T07:44:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![uli-a](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/uli-a/32/1315_2.png) [@uli-a](https://forum.collaboraonline.com/u/uli-a)\
**Post date:** [September 3, 2024, 7:44am UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/1 "2024-09-03T07:44:11Z")

</div>

Hello

I am running a Nextcloud server with multiple DNS aliases. When users try to open office documents this sometimes fails with the error message “Document loading failed”. In the console I see the following error message:

Content-Security-Policy: The page’s settings blocked the loading of a resource (form-action) at [https://dns-alias-1.tld/apps/richdocumentscode/proxy.php?req=/browser/xxx/cool.html?WOPISrc=https%3A%2F%2Fdns-alias-2.tld%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F....odt&lang=en&closebutton=1&revisionhistory=1](https://dns-alias-1.tld/apps/richdocumentscode/proxy.php?req=/browser/xxx/cool.html?WOPISrc=https%3A%2F%2Fdns-alias-2.tld%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F....odt&lang=en&closebutton=1&revisionhistory=1) because it violates the following directive: “form-action ‘self’ [https://dns-alias-2.tld](https://dns-alias-2.tld)”

In the Network tab of the webdeveloper tools I do not see a call to the URL mentioned above.

When connecting to Nextcloud with one DNS alias why are documents loaded from another DNS alias? Is there any way to fix this?

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [September 3, 2024, 9:37am UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/2 "2024-09-03T09:37:50Z")

</div>

Hello @uli-a i see there are some configuration issues.

- The error occurs because the document is being accessed from `https://dns-alias-1.tld`, but the form action is trying to submit to `https://dns-alias-2.tld`.

- The CSP rule allows form submissions only to `https://dns-alias-2.tld` and `self`, which in this context would mean `https://dns-alias-1.tld`. However, since `self` is `https://dns-alias-1.tld`, but the form is targeting `https://dns-alias-2.tld`, the browser blocks the request as a security measure.

- **Why This Happens** :

I would suggest if you should read this Multihost Configuration ([Configuration — SDK https://sdk.collaboraonline.com/ documentation](https://sdk.collaboraonline.com/docs/installation/Configuration.html#multihost-configuration)) this will help.

**Collabora Online Configuration** :

- Update the `coolwsd.xml` or `loolwsd.xml` file on your Collabora server to handle multiple DNS aliases properly. Ensure the `host` settings cover all the aliases you’re using.
- Make sure the `frame_ancestors` directive allows both DNS aliases if they are embedded in iframes.

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![uli-a](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/uli-a/32/1315_2.png) [@uli-a](https://forum.collaboraonline.com/u/uli-a)\
**Post date:** [September 3, 2024, 11:47am UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/3 "2024-09-03T11:47:08Z")

</div>

Thanks for the very elaborate answer.

I am using the build-in CODE server of Nextcloud and did not find the configuration files you mentioned (coolwsd.xml/loolwsd.xml). Is there a way to do this for the build-in server as well?

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [September 3, 2024, 12:05pm UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/4 "2024-09-03T12:05:49Z")

</div>

> [@uli-a](#):
>
> e DNS

@uli-a I see you are using build in.

So In your Nextcloud `config.php`, you can specify the `overwritehost` and `overwriteprotocol` settings to ensure consistent URLs are used, preventing such mismatches.

[https://docs.nextcloud.com/server/21/admin\_manual/configuration\_server/reverse\_proxy\_configuration.html?highlight=overwrite#overwrite-parameters](https://docs.nextcloud.com/server/21/admin_manual/configuration_server/reverse_proxy_configuration.html?highlight=overwrite#overwrite-parameters)

Until you check your config file, I’ll continue digging through articles to see if this issue is mentioned or if there is a workaround available.

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [September 3, 2024, 12:09pm UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/5 "2024-09-03T12:09:00Z")

</div>

> [@uli-a](#):
>
> form-action ‘self’

@uli-a i found something in NC  
forum [Refused to send form data to .. because it violates the following Content Security Policy directive: "form-action 'self'" - 📄 Collabora - Nextcloud community](https://help.nextcloud.com/t/refused-to-send-form-data-to-because-it-violates-the-following-content-security-policy-directive-form-action-self/133767)

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [September 5, 2024, 6:21am UTC](https://forum.collaboraonline.com/t/opening-office-documents-sometimes-fails/2941/6 "2024-09-05T06:21:01Z")

</div>


