NextCloud and PageKite reverse proxy - compatibility issues?

I have a Raspberry Pi 3 home server running Ubuntu MATE 16.04, Apache
and Nextcloud 9.0.51. Connecting to my Nextcloud
account from within the local network works fine. Now I installed
PageKite because I wanted to be able to access it externally. When I
first tried to connect to my-domain.pagekite.me, my Nextcloud announced
that my-domain.pagekite.me is not in the list of trusted domains and
offered me to add it which I did using the respective button. Now when I
try to connect to my-domain.pagekite.me, I am presented with a log-in
page with fields for the user name and the password but there is no
button for signing in. Pressing Enter doesn’t work either. I can just
type in my user name and password but can’t log in. Also the log-in page
looks a little bit different compared to the one I get from within the
local network, namely the standard background image (some mountain peaks
in clouds) is replaced by a solid blue background. I tried using 4
different browsers but it’s always the same. What could be the reason
for this strange behaviour? Logging in from within the local network
still works normally.

Hi! I’ve been using pagekite with owncloud on an arm SOC for many years now without the issues you are having.

I have put my local IP address in config.php as well, like so:

'trusted_domains' =>
array (
  0 => '192.168.1.25',
  1 => '_localServerName_',
  2 => 'cloud.blahblah.com',
),

I have a registered domain name, so I used that for my third entry above; I don’t know if you can use your pagekite name or not. I have an SSL certificate as well, so my pagekite “80_httpd.rc” looks like this:

service_on = http:blahblah.pagekite.me : localhost:80 : @kitesecret
service_on = http:cloud.blahblah.com : localhost:80 : @kitesecret
service_on = https:blahblah.pagekite.me : localhost:443 : @kitesecret
service_on = https:cloud.blahblah.com : localhost:443 : @kitesecret

So, I am routing both my domain name and pagekite address.

I have put nextcloud behind apache, so part of my VirtualHost file looks like so:

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerAdmin admin@blahblah.com
  ServerName cloud.blahblah.com
  ServerAlias blahblah.pagekite.me
  DocumentRoot /var/www/nextcloud
  SuexecUserGroup www-data www-data

Hope some of this helps!

2 Likes

Hi kinggrowler, thank you very much for your help! Actually my setup is very similar to yours, only that I don’t have the “SuexecUserGroup www-data www-data” line. Adding it caused the Apache server to fail to start, so I had to remove it. It seems that my problem is somewhere else. Looking into the browser console during loading the page I found the following:


It seems that a significant part of the js files are not served. If I open the log-in page by pointing the browser to the local network address, all js files are delivered and everything is normal. When I try to access the log-in page through my-domain.pagekit.me, about 60-70% of the js files are not delivered which results in missing log-in button and other elements on the page. Interestingly, the js files that don’t get delivered are not constant, I mean by repeatedly reloading the page sometimes a given js file is delivered and sometimes it’s not. Does anyone have an idea how to overcome this problem?

That is strange! It almost seems like the built-in pagekite firewall is being overly aggressive. From experience, I am not usually able to login to various “admin” pages over pagekite, but can do so locally.

Pagekite Firewall

One thought would be to temporarily disable the built-in pagekite firewall with the “+insecure” option for your kite.

Also, do you see anything interesting in the apache logs?

Let me know if this works! Thanks!

I disabled the firewall with the “+insecure” option but this didn’t help. :frowning:

In the apache access.log file, the js files are listed as having been accessed, no matter whether they were really delivered to the browser or not. Very strange.

I’m ready to try other suggestions, if you have any.

Wow, I’m not sure what to do at this point. I’m leaning towards a DNS issue, but that’s just a gut feeling. Have you tried creating an /etc/hosts entry for your pagekite.me name, and see if that changes anything? What happens when you do an an nslookup on both your pagekite.me name, and your DNS name?

Also, I’m assuming you have the same issues regardless which browser your use, but just want to make sure.

Here’s something else to try: Have you tried logging on to your nextcloud instance over TorBrowser? I often use the TorBrowser internally to help simulate how my site behaves externally. For example, I can access my instance either using the pagekite.me name, or my DNS name, via TorBrowser. I’m just trying to get a feel for what your environment is like. :frowning:

After having tried all of your suggestions and still not getting it work, I pointed the Apache server to open a locally stored htm file instead of the Nextcloud installation (just to test it). The htm file opened normally if I accessed it from a computer on the local network but if I tried to access it through PageKite the page loaded only partially and I got similar errors in the browser console. So, I concluded the problem had to be either in PageKite itself or in the configuration of the Apache server. Then I found an alternative reverse proxy service called ngrok. I removed PageKite, installed ngrok and now I can access my Nextcloud from outside :slight_smile:

1 Like

Glad you found a solution. Even if you’re not using it any more, can it would still help the PageKite developer if you filed an issue letting them know what happened. Either way, can welcome to Nextcloud and true Nextcloud community! :blush:

1 Like

I’d experimented a similar problem (see https://pagekite.net/support/forum/ item “Loading ressource page link with https failed”) ; it’s appeared to be related with Python installation on my Ubuntu 16.4.1 server (is this problem linked with Ubuntu 16.4.* ?).

I fixed it by creating an isolated python environment (see virtualenv features) and running pagekite on it.

Now Ican run an encrypted Nextcloud 9 on pagekite (version 0.5.8e) with a CNAME and a Letsencrypt certificate. :grinning:

1 Like

Hi.
Will nextcloud work through proxy like this http://advanced.name/ru ?

Try it and let us know! :wink: