Skip to content

Logout URL doesn't work if using reverse proxy #30097

Closed

Description

@dpeger

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

Activity

  1. dpeger commented on Jan 11, 2018

    @dpeger
    Author

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

  2. dpeger commented on Jan 18, 2018

    @dpeger
    Author

    I was able to fix the issue by adding

    'overwritehost' => 'owncloud.mydomain',
    

    to config.php

  3. edouardberthe commented on Sep 16, 2018

    @edouardberthe

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

  4. locked as resolved and limited conversation to collaborators on Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions