Skip to content

Nextcloud behind reverse proxy - WOPI URL changed from https to http

I'm trying out the "Nextcloud Office" app together with "Collabora Online - Built-in CODE Server". That Nextcloud instance is behind a reverse proxy.

The problem I encountered was that regardless of the 'overwritehost' and 'overwriteprotocol' settings, the WOPI URL kept being automatically changed from https to http.

From other posts regarding similar issues I figured out that the WOPI URL is obtained by querying https://[yourinstance]/apps/richdocumentscode/proxy.php?req=/hosting/discovery

Looking at the proxy.php source code, I found the reason for the issue:
// URL into this server of the proxy script.
if ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' )
|| (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on')
) {
$proxyURL = "https://";
} else {
$proxyURL = "http://";
}

I then modified my reverse proxy (Apache) config to add the missing header:
RequestHeader set X-Forwarded-Proto "https"

Now everything works as expected :-)


  • Twitter
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Nextcloud behind reverse proxy - WOPI URL changed from https to http
  • Mixx Nextcloud behind reverse proxy - WOPI URL changed from https to http
  • Bloglines Nextcloud behind reverse proxy - WOPI URL changed from https to http
  • Technorati Nextcloud behind reverse proxy - WOPI URL changed from https to http
  • Fark this: Nextcloud behind reverse proxy - WOPI URL changed from https to http
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at YahooMyWeb
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at Furl.net
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at reddit.com
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at blinklist.com
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at Spurl.net
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at NewsVine
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at Simpy.com
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http at blogmarks
  • Bookmark Nextcloud behind reverse proxy - WOPI URL changed from https to http with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Print this article!
  • E-mail this story to a friend!
  • Identi.ca