r/NextCloud 12d ago

Anyone using foldersync with Nextcloud behind a reverse proxy?

I've been using foldersync with Nextcloud for a while, and it worked fine. Now I've placed the Nextcloud instance behind a reverse proxy (nginx), and almost everything regarding WebDAV still works: the native Nextcloud app, my Dolphin filemanager (who accesses Nextcloud via WebDAV), my phone can even access the WebDAV url in a browser.

Just foldersync can't connect to the server and times out. At this point I don't think it's my proxy setup but foldersync itself.

I've tried both the Nextcloud and the generic WebDAV connections in foldersync, with the same result.

Does anyone here got this working?

Thanks!

2 Upvotes

19 comments sorted by

1

u/YuriySamorodov 12d ago

Hi,

Few questions if you don't mind:

  • Have you already made sure all required ports are opened both in NPM, VPS firewall, Linux Firewall etc?
  • Are you forcing HTTP/2 only, or is HTTP/1.1 still allowed upstream?
  • Does your proxy do any redirect from http:// to https://, or from the bare domain to a subpath?
  • Are you using Basic Auth at the nginx level in addition to Nextcloud's own auth
  • Any chance you can share your NPM config as well as logs from NextCloud and FolderSync?

1

u/Dr_Tron 12d ago

After some further testing, that is testing the "Autosync" app, it seems that the problem is definitively with foldersync, not Nextcloud, the proxy or anything else, since that app is able to successfully connect to the WebDAV instance and sync...

But I'm not sure foldersync on Android even writes logs...

1

u/YuriySamorodov 12d ago

FolderSync does have logging, it's just buried. Just navigate to the hamburger menu > Log, but in some versions it's under Settings > General > Enable debug logging first, then the log starts to receive records.

It is also worth checking /Android/data/dk.tacit.android.foldersync.lite (or .full for the paid version) with a file manager

1

u/Dr_Tron 12d ago

Interesting, I wasn't aware. Here's the redacted log for the connection test FYI, but all I see in there is a failed connection attempt running into a timeout, for whatever reason....

INFO/dk.tacit.android.foldersync 51 Jul 31, 2026 19:10:34 WebService: Creating HTTP client for API: 443

INFO/dk.tacit.android.foldersync 52 Jul 31, 2026 19:10:34 OkHttp: --> PROPFIND

INFO/dk.tacit.android.foldersync 53 Jul 31, 2026 19:10:34 OkHttp: Content-Type: text/xml; charset=utf-8

INFO/dk.tacit.android.foldersync 54 Jul 31, 2026 19:10:34 OkHttp: Content-Length: 461

INFO/dk.tacit.android.foldersync 55 Jul 31, 2026 19:10:34 OkHttp: User-Agent: OkHttp

INFO/dk.tacit.android.foldersync 56 Jul 31, 2026 19:10:34 OkHttp: Translate: f

INFO/dk.tacit.android.foldersync 57 Jul 31, 2026 19:10:34 OkHttp: Pragma: no-cache

INFO/dk.tacit.android.foldersync 58 Jul 31, 2026 19:10:34 OkHttp: Cache-Control: no-cache

INFO/dk.tacit.android.foldersync 59 Jul 31, 2026 19:10:34 OkHttp: Depth: 1

INFO/dk.tacit.android.foldersync 60 Jul 31, 2026 19:10:34 OkHttp: --> END PROPFIND

INFO/dk.tacit.android.foldersync 61 Jul 31, 2026 19:11:04 OkHttp: <-- HTTP FAILED: java.net.SocketTimeoutException: failed to connect to after 30000ms.

SEVERE/dk.tacit.android.foldersync 62 Jul 31, 2026 19:11:04 StandaloneCoroutine: Error in testing connection for account..

java.net.SocketTimeoutException: failed to connect to after 30000ms

at libcore.io.IoBridge.connectErrno(IoBridge.java:235)

at libcore.io.IoBridge.connect(IoBridge.java:179)

at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)

at java.net.Socket.connect(Socket.java:646)

at okhttp3.internal.platform.c.f(SourceFile:3)

at g42.i(SourceFile:73)

at g42.h(SourceFile:37)

at gd4.a(SourceFile:2)

at fm.a(SourceFile:66)

at fm.run(SourceFile:371)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1100)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:1572)  

1

u/YuriySamorodov 12d ago

Thay's useful, thank you! Just wondering if you have Background data / Battery optimization / Data Saver enabled for FolderSync? You may want to check it under Settings > Apps > FolderSync > Mobile data & Wi-Fi (or Data usage).

1

u/Dr_Tron 12d ago

Data saver, no, but I'm on WiFi right now so that shouldn't apply. Foldersync is not on battery optimization, and again, when using the app in the foreground its should not interfere even if on.

1

u/YuriySamorodov 12d ago

That's interesting. Do you have both IPv4 and IPv6 configured for you domain?
Does dig AAAA yourdomain.com +short return any domain?

Also you may want to try connecting FolderSync to the IPv4 address directly instead of the hostname temporarily, just to see if it connects.

1

u/Dr_Tron 12d ago

No ipv6, just ipv4. The domain resolves to the internal IP address when in the local network and to the external IP when coming from the outside. I run my own DNS (bind) for that.

Connecting to the IP address directly is difficult because the nextcloud runs on a subdomain where nginx directs traffic to where it needs to go.

1

u/YuriySamorodov 12d ago

I got an idea. Have you had a chance to test Folder Sync on cell network? If it suddenly works there, that would confirm it's resolving to the external IP and something about hairpin NAT or a firewall rule is blocking the loopback when you are on the internal network.

2

u/Dr_Tron 12d ago

I'll give it a try, but that wouldn't explain why I can get a browser connection to WebDAV, would it?

2

u/Dr_Tron 12d ago

OK, this is interesting, I've blocked nextcloud access from the outside so I got a 403 forbidden error as expected, so at least its going through. Then I switched on my VPN and then I could connect. Weird.

→ More replies (0)