[Solved] - Set httpS URL as trusted_domain in config.php

Ask all your questions regarding OC 6.x Please read the Support Forum Rules
Forum rules
ownCloud 6.x reached end of life and is officially unsupported. For details see Wiki page.

Please upgrade your ownCloud.
elite711
Newbie
Posts: 4
Joined: Wed May 07, 2014 12:08 am
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5

[Solved] - Set httpS URL as trusted_domain in config.php

Postby elite711 » Wed May 07, 2014 12:59 am

!!! Solution to my problem at the end of this first post !!!

Hi everyone,

I was running oc 6.0.2 perfectly:
- http access through port 8080 => worked perfectly (URL: [url]oc.my_domain.com:8080[/url])
- Then I enabled SSL and did some URL rewriting to force https (no special port so it was 443) => worked perfectly as well (URL: https://oc.my_domain.com)

Them I upgraded to oc 6.0.3 with the "auto-update" available on the admin page and at the end I had this message any people have:
"You are accessing the server from an untrusted domain. [...] If you are an administrator of this instance, configure the "trusted_domain" setting in config/config.php...

Here is what I did to make things work back again with http access through port 8080:
1. I disabled URL rewriting
2. I changed the config.php file and did the following regarding the trusted_domains array:

Code: Select all

'trusted_domains' =>
array ( 0 => 'oc.my_domain.com:8080', ),

3. Just to make sure everything was good, I tried to add a mistake in the URL like adding a 'x' at the beginning like this

Code: Select all

array ( 0 => 'xoc.my_domain.com:8080', ),
and indeed I got the error message again.


Then I decided to set URL rewriting back to force the use of https:
1. I re-enabled URL rewriting the way it was set before upgrading
2. I edited the config.php file to make it look like this:

Code: Select all

'trusted_domains' =>
array ( 0 => 'oc.my_domain.com:8080', 1 => 'https://oc.my_domain.com' ),
but it didn't work.
3. I tried to escape the double // from the quotes by writing it like this:

Code: Select all

1 => 'https:\/\/oc.my_domain.com'
but it didn't work.

So my question is, how to define the https URL as a trusted_domain?

Thank you for your time. Do not hesitate if you have any question.

Have a great day, Roger.

!!! Solution !!!
Ok, I was trying to make something simple complicated...
Here is how my config.php file now looks like:

Code: Select all

'trusted_domains' =>
  array (
    0 => 'oc.my_domain.com:8080',
    1 => 'oc.my_domain.com',
  ),
First I allowed the :8080 domain, then because there is URL-rewriting to force httpS I allowed the generic domain (as Rancor suggested) and everything works well =)

Thank you again Rancor!!

PS: I left the comma at the end as it is in the original config.php file and it works
Last edited by elite711 on Mon May 12, 2014 3:04 pm, edited 2 times in total.

elite711
Newbie
Posts: 4
Joined: Wed May 07, 2014 12:08 am
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5

Re: Set httpS URL as trusted_domain in config.php

Postby elite711 » Wed May 07, 2014 1:02 am

I am leaving my computer up and running for the moment.

If you try to connect to my site using this url: [url]oc.my_domain.com:8080[/url] you will be redirected to the https site but the :8080 will still remain so delete it from the re-writed URL and press ENTER again to have the "trusted_domain" error message appear.

I have to redo my url-rewriting rule to delete the port.
Last edited by elite711 on Mon May 12, 2014 3:05 pm, edited 3 times in total.

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: Set httpS URL as trusted_domain in config.php

Postby RealRancor » Wed May 07, 2014 7:39 am

Hi,

please see

viewtopic.php?f=17&t=20220

for the correct syntax of multiple domains. You also dont't have to include the https
*gone*

elite711
Newbie
Posts: 4
Joined: Wed May 07, 2014 12:08 am
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5

Re: Set httpS URL as trusted_domain in config.php

Postby elite711 » Wed May 07, 2014 9:45 am

Hi,
thank you for your quick answer. However I already went through the topic you sent before posting my message => without success.

Here is what worked well for http access through port 8080:

Code: Select all

'trusted_domains' => array('oc.my_domain.com:8080', ),
&

Code: Select all

'trusted_domains' => array ( 0 => 'oc.my_domain.com:8080', ),


Then I re-enabled url-rewriting to force the use of https and edited the trusted domain list.

First I tried:

Code: Select all

'trusted_domains' => array('oc.my_domain.com:8080', 'https://oc.my_domain.com', ),
=> Didn't work.

Then I tried the same but with escaping the // with \:

Code: Select all

'trusted_domains' => array('oc.my_domain.com:8080', 'https:\/\/oc.my_domain.com', ),
=> Didn't work.

Then I tried the following:

Code: Select all

'trusted_domains' => array ( 0 => 'oc.my_domain.com:8080', 1 => 'https://oc.my_domain.com', ),
=> Didn't work.

Again, I tried escaping the // with \:

Code: Select all

'trusted_domains' => array ( 0 => 'oc.my_domain.com:8080', 1 => 'https:\/\/oc.my_domain.com', ),
=> Didn't work.

Without specifying the httpS URL as a trusted URL I still have the error message! =(

Any further Idea? Anyone accessing oc 6.0.3 through https, could you copy your trusted_domain line here to see how you did (or any other trick to make https work fine)?
Last edited by elite711 on Mon May 12, 2014 3:05 pm, edited 2 times in total.

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: Set httpS URL as trusted_domain in config.php

Postby RealRancor » Wed May 07, 2014 12:37 pm

Hi,

only using https and this works for me in 6.0.3:

'trusted_domains' => array('cloud.example.com'),
*gone*

elite711
Newbie
Posts: 4
Joined: Wed May 07, 2014 12:08 am
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5

Re: Set httpS URL as trusted_domain in config.php

Postby elite711 » Wed May 07, 2014 2:25 pm

Alright, I'll try again tonight and I'll update my post.
Actually thinking about it I should probably add a second line without the 8080 port like this (taking into consideration it works fine through https for you):

Code: Select all

'trusted_domains' => array('oc.my_domain.com:8080', 'oc.my_domain.com', ),
or

Code: Select all

'trusted_domains' => array ( 0 => 'oc.my_domain.com:8080', 1 => 'oc.my_domain.com', ),


Cheers,
Roger
Last edited by elite711 on Wed May 07, 2014 8:24 pm, edited 1 time in total.

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: Set httpS URL as trusted_domain in config.php

Postby RealRancor » Wed May 07, 2014 2:53 pm

Hi,

use your first posted example. But there is a syntax error in it (one comma too much). Please compare it with the linked FAQ.
*gone*


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Community Edition 6.x”

Who is online

Users browsing this forum: No registered users and 1 guest