Nextcloud Inaccessible Via FQDN After Update

nmck160

Cadet
Joined
Jan 3, 2021
Messages
6
Hi all,

I believe this issue stems from the Nextcloud update to version 22, as everything was working fine before.

What I'm experiencing is extremely similar to what this person is experiencing.

So I have DDNS setup and HAProxy acting as a reverse proxy on my pfSense router, which also handles SSL offloading for my Nextcloud server with an ACME certificate.

I have a specific FQDN set up to be forwarded to my Nextcloud's server IP, which is left at the defaults to NAT to port 8282.

But since the update, Nextcloud also has opened up port 8283 for HTTPS connections, and I think there's something weird going on with the way the plugin sets up the nginx configuration to override some things? I'm not too sure.

Anyways, every time I try to access my Nextcloud server now (after changing HAProxy to redirect to port 8283 instead of 8282), I get a screen saying:

1632955868711.png


"400 Bad Request. The plain HTTP request was sent to HTTPS port".

Now I can only access Nextcloud through the "Manage" button on the plugin page.

The usual solution offered by some when encountering this error is to edit the `nginx.conf` file under `/usr/local/etc/nginx/` and add `ssl off;` to the file.

That has not fixed anything, and TrueNAS seems to revert the file to defaults after restarting the jail/plugin.

I've tried the usual of adding `'overwriteprotocol' => 'https',` to the `config.php` file, but that also does not do anything.

I've tried uninstalling the plugin and grabbing a fresh installation of the Nextcloud plugin, still the same issue. Also tried rebooting TrueNAS, again, nothing.

Any help would be appreciated!
 

ddaenen1

Patron
Joined
Nov 25, 2019
Messages
318
Have you actually checked if the update didn't cause NC to take a new IP address from the DHCP server in pfsense? Has happened to me before.
 

nmck160

Cadet
Joined
Jan 3, 2021
Messages
6
Yes I have.

I have a static DHCP lease set up for my TrueNAS box via its MAC address.

And since by default the Nextcloud plugin uses NAT, it's the same IP as the TrueNAS IP, just through a different port.

I can access Nextcloud via the "Manage" button on the Plugin page, and it has the expected IP address, it's just the FQDN that doesn't work.

Even though HAProxy has been correctly setup to forward that FQDN to TrueNASIP:8283 (I also tried 8282, doesn't work).
 

ddaenen1

Patron
Joined
Nov 25, 2019
Messages
318
I am still running NC 21.0.0 with an FQDN and pfsense 2.5.2 with ACME certs and HAProxy. So a very similar setup as yourself. I have not moved to 22 because i am concerned the update will break my NC installation with everything i have read so far. Never had any issues except when i updated pfsense from 2.4 to 2.5 which broke my HAProxy package. A simple reinstall of the package in pfsense fixed the issue.

What i do not have is the same IP for NC as for TrueNAS. I don't use NAT but autoconfigure IPv4 so NC has a dedicated IP which i have configured as a static lease in pfsense. Makes things easier imho.

Just one thought: you have not configured port 8283 for something else such as renewing the certs?
 
Last edited:

nmck160

Cadet
Joined
Jan 3, 2021
Messages
6
I tried your suggestion of re-installing the HAProxy package on pfSense, and it didn't do anything, but I appreciate the suggestion!

So I managed to get it to work, but not after some tweaking in
Code:
/usr/local/etc/nginx/conf.d/nextcloud.conf
Code:
`nextcloud.conf.template`
and
Code:
`/usr/local/www/nextcloud/config/config.php`


In both the `nextcloud.conf` and `nextcloud.conf.template` files, I basically had to get rid of anything referencing port 8283, port 443, SSL, ACME challenges, and such, and make it just listen on port 80.

In the `config.php` file I had to put the usual edit of `'overwriteprotocol' => 'https',` in there, as well as adding the FQDN to the list of trusted domains.

I had to get rid of the `forcessl => 'true',` line in `config.php` as it was messing it up still.

The last thing was to revert HAProxy pointing my FQDN from port 8283 (default HTTPS port for NC plugin) back to 8282 (default HTTP port for NC plugin).

After that it was smooth sailing!

This probably was the most crude method of doing this (I'm a noob in this general area of computing) and I don't advise someone doing this to get Nextcloud working in this kind of setup. Instead just stick to versions prior to 22.

EDIT: Posted too early accidentally so I had to finish it up in the edits.
 
Last edited:
Top