-
Notifications
You must be signed in to change notification settings - Fork 200
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
[BUG] Generally buggy behaviour when proxying Nextcloud #164
Comments
If you are using Nextcloud in docker, use the normal HTTP Port (80). SSL is done via Zoraxy, uncheck "Require TLS" and "Skip verififcation" and uncheck "Allow Plain HTTP" Require TLS and Allow plain HTTP are exactly the opposite :) I have Nextcloud running on my host. Zoraxy points to my Apache webserver which is serving Nextcloud. It works on the normal HTTP Port. Certificates are handled by Zoraxy, you should avoid additional HTTPS ports or configuration. Do you use the AIO image from Nextcloud? |
Nextcloud is getting confused because Zoraxy is sending the HTTP Host header of the endpoint, not the domain. If you configure Zoraxy to route I'm not sure if this is by design, but Nextcloud doesn't like it. The image I have is Here are the nginx error.log and access.log:
The The container image I'm using has this Docker-specific line:
I changed that CIDR from Docker's 172.x to Podman's
Still, the buggy broken links remain in the UI. I think it's this fastcgi param line that is giving PHP the wrong server name?
I asked nginx to log its
It seems:
So to workaround this in Nextcloud (or any downstream app that relies on HTTP Host header) you'll have to hardcode the nginx/apache server config to your domain... (note: nginx does not let you modify
Fixed it for me! 👍 |
@nettybun Thanks for the details debug and fixing process! |
That is interesting, as I am testing Zoraxy natively on my system (Windows) with a debug php script, I get the followings. <?php
$hostname = $_SERVER['HTTP_HOST'];
echo $hostname;
echo '<br>';
$hostname = $_SERVER['SERVER_NAME'];
echo $hostname;
echo '<br>';
$serverIp = $_SERVER['SERVER_ADDR'];
echo $serverIp;
echo '<br>';
?> Results
So php indeed grab the correct HTTP_HOST sent from Zoraxy. Besides, the //Hide Go-HTTP-Client UA if the client didnt sent us one
if _, ok := header["User-Agent"]; !ok {
// If the outbound request doesn't have a User-Agent header set,
// don't send the default Go HTTP client User-Agent.
header.Set("User-Agent", "")
} My assumption is that there is something wrong between Zoraxy and the Nginx server running NextCloud (php) and I cannot reproduce it with my environment. If anyone is available, please help by use the attached debug.php file and provide more information regarding setups that have shows this bug. UpdatesOk, I can reproduce this issue if and only if I run Zoraxy in docker and using the docker image from Here is my portainer / container setup with mydomain.com -> 192.168.1.202:8443 (NextCloud instance, Zoraxy proxy rule is set to TLS enabled and skip TLS validation check) Here is the result when Zoraxy is running natively (no docker) and NextCloud in container Here is result when Zoraxy is running in docker and connecting to a PHP server, the HTTP_HOST header is correctly shown. Updates 2Try to comment this line (in the actual default.conf file in container volume) and see if everything just magically works again? |
@tobychui whoa! Thanks for putting so much effort into it. However, I worry you may be seeing the same issue as me: If you hover on these thumbnails it will say http://192.168...? Maybe? Those thumbnails for me were pointing to http://127.0.0.1:8443 I'll be back at a laptop soon and I can test with your debug script. |
I used your debug.php script by directly putting it into the nextcloud image under Seems like the HTTP Host header is mangled somehow very odd... I'll keep investigating! |
ooo FOUND SOMETHING. I think Zoraxy has different Go HTTP Clients for HTTP vs HTTPS? You're right that HTTP is OK, but Nextcloud uses HTTPS! I spin up two https://hub.docker.com/r/traefik/whoami containers (no PHP, written in Go):
Note that The host headers are different! Zoraxy is sending the correct one for HTTP, but incorrect for HTTPS. I believe this IS a bug in Zoraxy. Hope this is helpful! |
This looks like the cause of the bug. @tobychui I don't understand the code comment; can you advise if it is safe to modify this? Rebuild with This also fixed Nextcloud! See how now the thumbnails are working - they aren't "?" anymore, they are the real thing: Can we push this fix? I worry the code comment is telling me the change is not this easy though >_> |
After adding the domain in the config.php inside the docker volume and patched PR #168, this bug has been fixed. I guess this bug also partly fixed the Proxmox issues which I will investigate later. Thanks so much for everyone involved and help making Zoraxy a better tool! |
So I'm attempting to proxy my nextcloud instance, I've got the trusted IPs setup in nextcloud and have had this nextcloud instance proxied successfully via NPM in the past. However, it seems like Nextcloud really doesn't like being proxied via Zoraxy. Looking at the browser console, it seems like it's not properly proxying resource requests to be done via the domain, rather trying to directly access the resources via either the docker IP or the local IP address.
To Reproduce
![image](https://private-user-images.githubusercontent.com/8294697/332621014-2be64e8e-7641-40c1-a4e3-d8ece33f5765.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NDIxNTAsIm5iZiI6MTczOTY0MTg1MCwicGF0aCI6Ii84Mjk0Njk3LzMzMjYyMTAxNC0yYmU2NGU4ZS03NjQxLTQwYzEtYTRlMy1kOGVjZTMzZjU3NjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTc1MDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2MzNTZmYWU4OTViZTQxZDIyYzZkYWZhNmRhMTFkZmU4NzMzNGI1ODA1ZGM5YzEzYjEwNGQzYTY3MmU0ZjhlZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Qjpz39Ms71uqpv-_vZz6Owq7aqW1DVq6a-r9CVS52r0)
Nextcloud proxy:
Changing to the local IP address instead of the docker one will simply result in it working, but only VIA LAN connections.
Expected behavior
Nextcloud should load as normal.
Browser (if it is a bug appears on the UI section of the system):
Host Environment (please complete the following information):
Additional context
I cannot reproduce this behaviour with my Crafty or Dozzle instance, they work just fine.
The text was updated successfully, but these errors were encountered: