# Error when trying to connect (Host violates local access rules) - Onlyoffice

**URL:** <https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415>\
**Category:** 📄 Office\
**Tags:** nc22, onlyoffice\
**Created:** [October 14, 2021, 2:08pm UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415 "2021-10-14T14:08:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![techman2005](https://help.nextcloud.com/letter_avatar/techman2005/32/5_5575768a8748004e209b776fc1b2916d.png) [@techman2005](https://help.nextcloud.com/u/techman2005)\
**Post date:** [October 14, 2021, 2:08pm UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415/1 "2021-10-14T14:08:33Z")

</div>

Error appeared after upgrading to 22.2.0 this configuration has been working for years and now I cant connect Onlyoffice. Any help to try and fix this would be greatly appreciated.

I tried adding this into my config but when added it breaks everything ‘allow\_local\_remote\_servers’ =\> true, I have to leave it out as of now. Last thing to note is the fact that I am using a reverse proxy on a separate server.

“app”:“onlyoffice”,“method”:“PUT”,“url”:“/index.php/apps/onlyoffice/ajax/settings/address”,“message”:“HealthcheckRequest on check error”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36”,“version”:“22.2.0.2”,“exception”:{“Exception”:“OCP\Http\Client\LocalServerException”,“Message”:“Host violates local access rules”,“Code”:0,“Trace”:[{“file”:“/srv/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php”,“line”:136,“function”:“ThrowIfLocalIp”,“class”:“OC\Http\Client\LocalAddressChecker”,“type”:“-\>”},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php”,“line”:35,“function”:“OC\Http\Client\{closure}”,“class”:“OC\Http\Client\DnsPinMiddleware”,“type”:“-\>”,“args”:[“\*\*\* sensitive parameters replaced _**“]},{“file”:”/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php",“line”:31,“function”:“\_\_invoke”,“class”:“GuzzleHttp\PrepareBodyMiddleware”,“type”:“-\>”},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php”,“line”:71,“function”:“GuzzleHttp\{closure}”,“class”:“GuzzleHttp\Middleware”,“type”:“::”,“args”:["**_ sensitive parameters replaced _**“]},{“file”:”/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php",“line”:63,“function”:“\_\_invoke”,“class”:“GuzzleHttp\RedirectMiddleware”,“type”:“-\>”},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php”,“line”:75,“function”:“GuzzleHttp\{closure}”,“class”:“GuzzleHttp\Middleware”,“type”:“::”,“args”:["**_ sensitive parameters replaced \*\*\*”]},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php”,“line”:331,“function”:“\_\_invoke”,“class”:“GuzzleHttp\HandlerStack”,“type”:“-\>”},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php”,“line”:168,“function”:“transfer”,“class”:“GuzzleHttp\Client”,“type”:“-\>”},{“file”:“/srv/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php”,“line”:187,“function”:“requestAsync”,“class”:“GuzzleHttp\Client”,“type”:“-\>”},{“file”:“/srv/nextcloud/lib/private/Http/Client/Client.php”,“line”:223,“function”:“request”,“class”:“GuzzleHttp\Client”,“type”:“-\>”},{“file”:“/srv/nextcloud/apps/onlyoffice/lib/documentservice.php”,“line”:364,“function”:“get”,“class”:“OC\Http\Client\Client”,“type”:“-\>”},{“file”:“/srv/nextcloud/apps/onlyoffice/lib/documentservice.php”,“line”:253,“function”:“Request”,“class”:“OCA\Onlyoffice\DocumentService”,“type”:“-\>”},{“file”:“/srv/nextcloud/apps/onlyoffice/lib/documentservice.php”,“line”:396,“function”:“HealthcheckRequest”,“class”:“OCA\Onlyoffice\DocumentService”,“type”:“-\>”},{“file”:“/srv/nextcloud/apps/onlyoffice/controller/settingscontroller.php”,“line”:172,“function”:“checkDocServiceUrl”,“class”:“OCA\Onlyoffice\DocumentService”,“type”:“-\>”},{“file”:“/srv/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:217,“function”:“SaveAddress”,“class”:“OCA\Onlyoffice\Controller\SettingsController”,“type”:“-\>”},{“file”:“/srv/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:126,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“-\>”},{“file”:“/srv/nextcloud/lib/private/AppFramework/App.php”,“line”:156,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“-\>”},{“file”:“/srv/nextcloud/lib/private/Route/Router.php”,“line”:301,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“file”:“/srv/nextcloud/lib/base.php”,“line”:1000,“function”:“match”,“class”:“OC\Route\Router”,“type”:“-\>”},{“file”:“/srv/nextcloud/index.php”,“line”:36,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/srv/nextcloud/lib/private/Http/Client/LocalAddressChecker.php”,“Line”:42,“CustomMessage”:“HealthcheckRequest on check error”}}

---

<div class="post-metadata">

**Author:** ![mueller](https://help.nextcloud.com/letter_avatar/mueller/32/5_5575768a8748004e209b776fc1b2916d.png) [@mueller](https://help.nextcloud.com/u/mueller)\
**Post date:** [November 5, 2021, 11:35am UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415/2 "2021-11-05T11:35:05Z")

</div>

The same thing with me. I updated to onlyoffice 7.2.0 with the minor version there was no problem!?

---

<div class="post-metadata">

**Author:** ![dlevequeIT](https://help.nextcloud.com/letter_avatar/dlevequeit/32/5_5575768a8748004e209b776fc1b2916d.png) [@dlevequeIT](https://help.nextcloud.com/u/dlevequeIT)\
**Post date:** [March 3, 2022, 3:37pm UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415/3 "2022-03-03T15:37:49Z")

</div>

Hello,  
I have the same problem after a complete reinstallation.  
Errors in my nextcloud log is the following:

```auto
{"reqId":"YiDfyWWW36ejAkly2znRjwAAAAE","level":2,"time":"2022-03-03T15:33:29+00:00","remoteAddr":"192.168.10.250","user":"damien","app":"no app in context","method":"PUT","url":"/index.php/apps/onlyoffice/ajax/settings/address","message":"Host 192.168.10.240 was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.121 Safari/537.36","version":"23.0.2.1"}
{"reqId":"YiDfyWWW36ejAkly2znRjwAAAAE","level":3,"time":"2022-03-03T15:33:29+00:00","remoteAddr":"192.168.10.250","user":"damien","app":"onlyoffice","method":"PUT","url":"/index.php/apps/onlyoffice/ajax/settings/address","message":"HealthcheckRequest on check error","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.121 Safari/537.36","version":"23.0.2.1","exception":{"Exception":"OCP\\Http\\Client\\LocalServerException","Message":"Host violates local access rules","Code":0,"Trace":[{"file":"/var/www/nextcloudHome/lib/private/Http/Client/DnsPinMiddleware.php","line":136,"function":"ThrowIfLocalIp","class":"OC\\Http\\Client\\LocalAddressChecker","type":"->"},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php","line":35,"function":"OC\\Http\\Client\\{closure}","class":"OC\\Http\\Client\\DnsPinMiddleware","type":"->","args":[" ***sensitive parameters replaced***"]},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":31,"function":"__invoke","class":"GuzzleHttp\\PrepareBodyMiddleware","type":"->"},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php","line":71,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":[" ***sensitive parameters replaced***"]},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":63,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->"},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php","line":75,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":[" ***sensitive parameters replaced***"]},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/Client.php","line":331,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->"},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/Client.php","line":168,"function":"transfer","class":"GuzzleHttp\\Client","type":"->"},{"file":"/var/www/nextcloudHome/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->"},{"file":"/var/www/nextcloudHome/lib/private/Http/Client/Client.php","line":223,"function":"request","class":"GuzzleHttp\\Client","type":"->"},{"file":"/var/www/nextcloudHome/apps/onlyoffice/lib/documentservice.php","line":364,"function":"get","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/var/www/nextcloudHome/apps/onlyoffice/lib/documentservice.php","line":253,"function":"Request","class":"OCA\\Onlyoffice\\DocumentService","type":"->"},{"file":"/var/www/nextcloudHome/apps/onlyoffice/lib/documentservice.php","line":396,"function":"HealthcheckRequest","class":"OCA\\Onlyoffice\\DocumentService","type":"->"},{"file":"/var/www/nextcloudHome/apps/onlyoffice/controller/settingscontroller.php","line":172,"function":"checkDocServiceUrl","class":"OCA\\Onlyoffice\\DocumentService","type":"->"},{"file":"/var/www/nextcloudHome/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"SaveAddress","class":"OCA\\Onlyoffice\\Controller\\SettingsController","type":"->"},{"file":"/var/www/nextcloudHome/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloudHome/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloudHome/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloudHome/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloudHome/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloudHome/lib/private/Http/Client/LocalAddressChecker.php","Line":42,"CustomMessage":"HealthcheckRequest on check error"}}

```

I have verified and already tried to add in my config/config.php file:

> ‘onlyoffice’ =\>  
> array (  
> ‘verify\_peer\_off’ =\> false,  
> ),  
> ‘allow\_local\_remote\_servers’ =\> true,

OR

> ‘allow\_local\_remote\_servers’ =\> true,

I have also tried the following command:

> sudo -u www-data php ./nextcloudHome/occ config:system:set allow\_local\_remote\_servers --value true --type bool

I have read many support topics and tried many suggested solutions but it always failed. I have no other idea, please help me my friends

---

<div class="post-metadata">

**Author:** ![sjash](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sjash/32/25494_2.png) [@sjash](https://help.nextcloud.com/u/sjash)\
**Post date:** [December 15, 2022, 7:03am UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415/4 "2022-12-15T07:03:32Z")

</div>

Solution is given in below Link

> [@Can't connect to OnlyOffice document server after update to NC19](https://help.nextcloud.com/t/cant-connect-to-onlyoffice-document-server-after-update-to-nc19/83958/2):
>
> It happens in new version of nextcloud, that checks local for dot (.) in adress if there it is: /lib/private/Http/Client.php -\> preventLocalAddress // Disallow hostname only if (substr\_count($host, ‘.’) === 0) { … The solution: change local address with dot included address: for example local.cloud

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 14, 2024, 3:11pm UTC](https://help.nextcloud.com/t/error-when-trying-to-connect-host-violates-local-access-rules-onlyoffice/125415/5 "2024-12-14T15:11:05Z")

</div>


