PHP Errors when accessing from outside network

#1

I successfully installed Next Cloud, and have been able to use it from within my local network. However, when I currently try to access it from outside my local network (using either external IP or mydomain.com) I get an HTTP Error 500 ( mydomain.com is currently unable to handle this request.).

I noticed that under the logging, I see the same 4 errors pop up every time I try to access my server externally.

Here is error #1:
[PHP] Error: TypeError: Return value of OC\AppFramework\Http\Request::getServerHost() must be of the type string, null returned at /snap/nextcloud/13453/htdocs/lib/private/AppFramework/Http/Request.php#907

GET /
from 192.168.254.254 at 2019-06-08T20:56:28+00:00

Here is error #2:
[PHP] Error: Undefined offset: 0 at /snap/nextcloud/13453/htdocs/lib/private/AppFramework/Http/Request.php#907

GET /
from 192.168.254.254 at 2019-06-08T20:56:28+00:00

Error #3:
[index] Error: TypeError: Return value of OC\AppFramework\Http\Request::getServerHost() must be of the type string, null returned at <>

  1. /snap/nextcloud/13453/htdocs/lib/private/URLGenerator.php line 266
    getServerHost()
  2. /snap/nextcloud/13453/htdocs/lib/private/Template/JSCombiner.php line 72
    getBaseUrl()
  3. /snap/nextcloud/13453/htdocs/lib/private/Server.php line 992
    __construct(OC\Files\AppData\AppData {}, OC\URLGenerator {}, OC\Memcache\Factory {}, OC\SystemConfig {}, OC\Log {})
  4. /snap/nextcloud/13453/htdocs/3rdparty/pimple/pimple/src/Pimple/Container.php line 118
    OC{closure}("*** sensitive parameters replaced ***")
  5. /snap/nextcloud/13453/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php line 117
    offsetGet(“OC\Template\JSCombiner”)
  6. /snap/nextcloud/13453/htdocs/lib/private/ServerContainer.php line 132
    query(“OC\Template\JSCombiner”)
  7. /snap/nextcloud/13453/htdocs/lib/private/TemplateLayout.php line 326
    query(“OC\Template\JSCombiner”)
  8. /snap/nextcloud/13453/htdocs/lib/private/TemplateLayout.php line 160
    findJavascriptFiles([“vendor/core”," … "])
  9. /snap/nextcloud/13453/htdocs/lib/private/legacy/template.php line 211
    __construct(“guest”, “core”)
  10. /snap/nextcloud/13453/htdocs/lib/private/Template/Base.php line 132
    fetchPage()
  11. /snap/nextcloud/13453/htdocs/lib/base.php line 797
    printPage()
  12. /snap/nextcloud/13453/htdocs/lib/base.php line 1068
    init()
  13. /snap/nextcloud/13453/htdocs/index.php line 40
    require_once("/snap/nextcloud … p")

GET /
from 192.168.254.254 at 2019-06-08T20:56:28+00:100:

And finally, error #4:
[PHP] Error: Undefined offset: 0 at /snap/nextcloud/13453/htdocs/lib/private/AppFramework/Http/Request.php#907

GET /
from 192.168.254.254 at 2019-06-08T20:56:28+00:00

I also noticed that under the setup and security warnings, it says I am missing a recommended PHP module, imagick. I’m not sure if this is related.

I am using the snap package, on Ubuntu 18.04. Both port 80 and 443 are forwarded, and not blocked by my ISP or firewall. I’m familiar with the linux terminal, but not with PHP or Apache.

Thanks in advance!

#2

Hi Adeel_Rehman,

I was facing a similar issue using an upstream proxy-server. Setting the “overwritehost” configuration solved this issue. To set this parameter add/change this value in config/config.php file. (In docker-compose setup docker-compose exec --user www-data app php occ config:system:set “overwritehost” --value=yourSSLdomain.tld .)

See https://docs.nextcloud.com/server/16/admin_manual/configuration_server/reverse_proxy_configuration.html - there are some other parameters to be set in a productiv environment.

Hope this helped.

#3

I’m not using a proxy server, so I don’t think this is what is causing the issue.