Selective reverse proxy


#1

Hi,
I need to proxy Owncloud for all connections originating from my nginx reverse proxy server (192_168_5_116 accessible as xyz_com), but handle everything normally from other locations.

Due to lack of privileges on this site, I've had to change all . in addresses to _

I've edited config.php to contain this;
'trusted_proxies'=>['192_168_5_116'],
'overwritehost'=> 'xyz_com',
'overwriteprotocol' => 'https',
'overwritewebroot' => '/owncloud',
'overwritecondaddr' => '^192_168_5_116$',

My nginx config for this location is;
location /owncloud {
proxy_pass http://owncloud_dmz_com;
proxy_buffering off;
access_log /var/log/nginx/owncloud_access.log;
tcp_nodelay on;
tcp_nopush off;
add_header X-Frame-Options SAMEORIGIN;
}

When this is set up everything works great through the proxy, but I can't access the owncloud server directly http://owncloud_dmz_com . It seems to try to redirect to xyz.com

When I comment all of the lines shown out of the config.php, owncloud through the proxy breaks on logout, but I can access it directly.

Both owncloud.dmz.com and xyz.com are listed under trusted_domains. I'm wondering if I have to forward to the proxy servers IP address?

How can I arrange this so that owncloud works correctly independently and through the proxy.

Thanks,
James