Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDAV not working if running webserver and reverse proxy in ports different from standard #2573

Closed
anonimou0 opened this issue Dec 8, 2016 · 4 comments

Comments

@anonimou0
Copy link

anonimou0 commented Dec 8, 2016

Steps to reproduce

  1. Run a nginx reverse proxy, receiving connections on port, let's say, 5000. It will take the request (on example.com/nextcloud) an forward to apache which will be running the nexcloud. Nginx take care of ssl certificate.
  2. Run the apache on http-only, on a port different from default (80 and 443), let's say 5432.
  3. Try to connect with DAVDroid to example.com/nextcloud/remote.php/webdav/ .

Expected behaviour

It was expected to connect at the nextcloud and able to share contacts and calendar, for example.

Actual behaviour

DAVDroid get stuck on Configuration detection. Wait, looking for server... . Even if I enter a wrong password it get stuck on this message. If I enter the right user/password, under nextcloud Admin, it shows that DAVDroid got connected but gets stucked on this message..
The nextcloud app works. "davs:// on linux" works..

Server configuration

Operating system: Armbian Jessie
Web server: Apache + nginx (reserve proxy)
Database: MySQL
PHP version: PHP5
Nextcloud version: 10.1
Updated from an older Nextcloud/ownCloud or fresh install: Fresh install
Where did you install Nextcloud from: downloaded from nextcloud.com
Signing status:
No errors have been found.

List of activated apps:
Default Apps + External Storage

The content of config/config.php:
Here's the relevant part:

` 'trusted_arrays' => array ( 0 => '192.168.1.98'), 'datadirectory' => '/media/data/nextcloud/', 'overwrite.cli.url' => 'https://example.com:5000/nextcloud/', 'overwritehost' => 'example.com:5000', 'overwriteprotocol' => 'https', 'overwritewebroot' => '/nextcloud', `

Are you using external storage, if yes which one: local

Are you using encryption: no

Client configuration

Browser:
Acessing via any browser the referece link (example.com:5000/nextcloud/remote.php/webdav):
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client.

Checking on similar issues, people got it working redirecting the WAN port to the 443 ou 80 port, in LAN port or making hosts redirecting to localhost 127.0.0.1 example.com .
When connecting to nextcloud, I got sometimes:
Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken. Please double check the installation guides.

If I try the overwritehost option, changing it to 192.168.1.98 some links get the hardlink (as external download or logout). That's why I'm using the http link on overwritehost.

Some reference:
owncloud/core#2495
owncloud/core#2511

@anonimou0
Copy link
Author

Looking further, it seems that the server can't redirect the requests for the /carddav and the /caldav accordingly.
I'm trying to redirect it to the right port, in the .htaccess, with the RewriteEngine, I'm changing the well-known part of it, as follow:

RewriteRule ^\.well-known/carddav https://example.com:5000/nextcloud/remote.php/dav/ #[R=301,L]
RewriteRule ^\.well-known/caldav https://example.com:5000/nextcloud/remote.php/dav/ # [R=301,L]

However, I still didn't manage to get it right. Does anyone know how I do it? Is there an easy way?

@anonimou0
Copy link
Author

anonimou0 commented Dec 8, 2016

A little bit more:
Accessing https://example.com:5000/nextcloud/remote.php/carddav and /caldav, I get the following:

<d:error>
<s:sabredav-version>3.0.9</s:sabredav-version>
<s:exception>Sabre\DAV\Exception\NotImplemented</s:exception>
<s:message>There was no handler found for this "GET" method</s:message>
</d:error>

Accessing other random links on remote.php says that the app isn't installed.

And another references:
sabre-io/Baikal#401
owncloud/core#19801

@nickvergessen
Copy link
Member

Can you check whether the proxy settings help?

/**
* Proxy Configurations
*/
/**
* The automatic hostname detection of Nextcloud can fail in certain reverse
* proxy and CLI/cron situations. This option allows you to manually override
* the automatic detection; for example ``www.example.com``, or specify the port
* ``www.example.com:8080``.
*/
'overwritehost' => '',
/**
* When generating URLs, Nextcloud attempts to detect whether the server is
* accessed via ``https`` or ``http``. However, if Nextcloud is behind a proxy
* and the proxy handles the ``https`` calls, Nextcloud would not know that
* ``ssl`` is in use, which would result in incorrect URLs being generated.
* Valid values are ``http`` and ``https``.
*/
'overwriteprotocol' => '',
/**
* Nextcloud attempts to detect the webroot for generating URLs automatically.
* For example, if ``www.example.com/nextcloud`` is the URL pointing to the
* Nextcloud instance, the webroot is ``/nextcloud``. When proxies are in use,
* it may be difficult for Nextcloud to detect this parameter, resulting in
* invalid URLs.
*/
'overwritewebroot' => '',
/**
* This option allows you to define a manual override condition as a regular
* expression for the remote IP address. For example, defining a range of IP
* addresses starting with ``10.0.0.`` and ending with 1 to 3:
* ``^10\.0\.0\.[1-3]$``
*/
'overwritecondaddr' => '',

@anonimou0
Copy link
Author

@nickvergessen , actually, I already had those setted.
However, after messing arrowing yesterday, I was able to get it working. Not sure exactly what I did (if in DAVDroid or Nextcloud)
I don't remember changing anything aside from using example.com/nextcloud/remote.php/dav/ {{intead of example.com/nextcloud/remote.php/webdav/ }}.

Anyway, it seems fixed. Not sure exactly why.
Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants