Untrusted Domain/Redirected to localhost/127.0.0.1/local IP

Here we try to answer typical questions
Forum rules
The forums were migrated over to https://central.owncloud.org which is based on the forum software Discourse. The forums here is put into read-only mode starting from today.

More background information about this move and the reasoning behind it is available in this blogpost:

https://daniel.molkentin.net/2016/07/20 ... d-central/
User avatar
RandolphCarter
ownCloud master
Posts: 5134
Joined: Wed May 30, 2012 8:42 am
ownCloud version: 8.1.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Untrusted Domain/Redirected to localhost/127.0.0.1/local IP

Postby RandolphCarter » Sat Mar 08, 2014 10:15 pm

Problem:
When accessing ownCloud, after logging in, you're being redirected to localhost or 127.0.0.1; or to an IP address from your local network, when you're actually accessing ownCloud from externally.
Or you are being told that "You are accessing the server from an untrusted domain. Please contact your administrator".

Answer:
ownCloud 6.0.x introduced a trusted_domain setting.
This setting needs to contain the host name or IP address that ownCloud is accessed under (the server's domain / host name or IP address, not those of clients!)

The URL used for setting up the ownCloud server for the first time is stored in this configuration entry; and only accesses from URLs contained in that setting are allowed; all accesses from different URLs will be redirected to the first URL mentioned in those settings.

So to allow access from a specific URL, add this URL to the configuration entry.

Example 1:

You want to allow access your ownCloud via foo.example.com (i.e., users will enter

Code: Select all

https://foo.example.com/path/to/owncloud

in the browser or in their clients to get access to the ownCloud installation).

Then your trusted domain should look like this:

Code: Select all

'trusted_domains' => array('foo.example.com'),


Example 2:
Let's say that in addition to the domain from example 1, you want to allow your users to access ownCloud via the domain bar.example.com, and let's say also via foo2.example.com on a non-standard port 12321; where foo.example.com should be the the primary URL to be used; then make your trusted_domain entry look like this:

Code: Select all

'trusted_domains' => array (
'foo.example.com',
'bar.example.com',
'foo2.example.com:12321'
),



Also see the documentation: http://doc.owncloud.org/server/6.0/admi ... .html#note

Starting with OC 7.0.2 a "Trusted Domain Wizard" was introduced which makes this process easier:

https://github.com/owncloud/core/pull/10584
Last edited by rakekniven on Tue Jan 13, 2015 12:41 pm, edited 7 times in total.
Reason: Added example for nonstandard port, Added note about trusted domain wizard

digitallogistics
Newbie
Posts: 5
Joined: Wed Mar 26, 2014 7:12 pm
ownCloud version: 6.0.2
Webserver: Apache
Database: MySQL
OS: Linux

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby digitallogistics » Wed Mar 26, 2014 11:04 pm

danke für die info.

kannste bitte mal nem linux n00b sagen wo die datei liegt?

danke Alex.

User avatar
RandolphCarter
ownCloud master
Posts: 5134
Joined: Wed May 30, 2012 8:42 am
ownCloud version: 8.1.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby RandolphCarter » Wed Mar 26, 2014 11:08 pm

wo die datei liegt?

where which file resides? config.php which contains the trusted_domain setting? That can be found in the config subdirectory of your ownCloud folder...

digitallogistics
Newbie
Posts: 5
Joined: Wed Mar 26, 2014 7:12 pm
ownCloud version: 6.0.2
Webserver: Apache
Database: MySQL
OS: Linux

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby digitallogistics » Thu Mar 27, 2014 8:43 am

Thank you. Working now.

Gwynfor
Newbie
Posts: 2
Joined: Wed Apr 30, 2014 11:27 am

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby Gwynfor » Wed Apr 30, 2014 11:35 am

Hi,
are wildcards possible?

Thanks,
Andreas

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby RealRancor » Wed Apr 30, 2014 12:14 pm

Hi,

have you tried to use wildcards? Should be easy to test if you want to use them.
*gone*

Gwynfor
Newbie
Posts: 2
Joined: Wed Apr 30, 2014 11:27 am

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby Gwynfor » Tue May 06, 2014 10:23 am

Moin,
Rancor wrote:have you tried to use wildcards? Should be easy to test if you want to use them.

I tried and failed. It seems it only accepts fqdn's. I tried *.domain.somewhere and .domain.somewhere, but both where rejected. Unfortunatly I rely on randomhost.domain.somewhere (don't ask!).
If wildcards are not possible, how do I turn this feature off?

Thanks,
Andreas

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby RealRancor » Tue May 06, 2014 4:25 pm

Hi,

just remove the config option from your config.php.
*gone*

Scrabbledo
Newbie
Posts: 2
Joined: Thu Feb 27, 2014 11:32 am
ownCloud version: 6.0.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: latest

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby Scrabbledo » Thu Jun 12, 2014 10:49 pm

Hi Randolph,

I've the same problem since I've updated to v6.0.3.3 today.

First: I use owncloud on a Synology NAS.

So after the update I couldn't get access (untrusted domain) to my owncloud from external and took a look here in the forum.
After that I've installed WinSCP to get access to the ownCloud-installation on my nas and I've searched for the config.php but I've not found one!

Some time later I found a installation of owncloud under:
/volume1/@appstore/owncloud/share/config

In this directory I've found the config.sample.php but no config.php! Here I've renamed this to config.php and added the external DynDNS-Domain how described. BUT it didn't work!

From internal network I can reach the ownCloud-frontend per IP (e.g. 192.168.0.10/owncloud) but not if I try from external (e.g. mynas.dyndns.de <-- so I've added in config.php e.g.: array('mynas.dyndns.de') ).

Now I've restart the owncloud-service on the synology-nas but no change. Can you give me a hint what could be wrong? (wrong config.php for example because why didn't exist this file already?)

Thanks initially!

Scrab

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Untrusted Domain/Redirected to localhost/127.0.0.1/local

Postby RealRancor » Thu Jun 12, 2014 10:54 pm

Hi,

yes you have picked the wrong config.php. There must be a config.php somewhere besides the config.sample.php and you don't need to copy over the config.sample.php to config.php.

You should be able to find the correct config.php using some common linux search tools like find or locate.
*gone*


  • Similar Topics
    Replies
    Views
    Last post

Return to “FAQ”

Who is online

Users browsing this forum: No registered users and 1 guest