Core: Logout URL doesn't work if using reverse proxy

Created on 11 Jan 2018  路  3Comments  路  Source: owncloud/core

Hi,

I recently switched from installing ownCloud to using the official ownCloud docker image. As I don't want to allow direct remote access to the docker containers, I'm using nginx as reverse proxy in front of owncloud-docker. The docker ports 80 and 443 are mapped to the system ports 8080 and 8443 respectively.

Nginx is acting as a reverse proxy for https://localhost:8443 (proxy_pass https://localhost:8443).

The setup works quite fine out-of-the-box but I'm not able to logout as the target URL of the logout link is https://localhost:8443/logout?requesttoken=... instead of https://owncloud.mydomain/logout?requesttoken=...

I already took a short look at the code and was able to fix the issue for me by changing this line in user.php from

   $logoutUrl = \OC::$server->getURLGenerator()->linkToRouteAbsolute(

to

   $logoutUrl = \OC::$server->getURLGenerator()->linkToRoute(

However as I'm not familiar with the ownCloud code at all, I don't know if this is the correct fix or if linkToRouteAbsolute should already return the correct URL.

Steps to reproduce

  1. Setup ownCloud behind reverse proxy
  2. Try to logout

Expected behaviour

Logout should be using the remote accessible URL

Actual behaviour

Logout is using the internal URL

Server configuration

ownCloud version: 10.0.4

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: Offcial owncloud-docker Dockerfile

Bug server

Most helpful comment

I was able to fix the issue by adding

'overwritehost' => 'owncloud.mydomain',

to config.php

All 3 comments

If the above fix is correct, I can provide a pull request, if wanted.

I was able to fix the issue by adding

'overwritehost' => 'owncloud.mydomain',

to config.php

Same setup, same problem, the fix worked for me. Thanks !

Was this page helpful?
0 / 5 - 0 ratings