Closed MostHated closed 5 years ago
Use Caddy version 0.11.5 for now. There have been other reported issues with building some plugins (including Cloudflare) with Caddy 1.0 due to the new requirement of Go modules https://github.com/abiosoft/caddy-docker/issues/186 and https://github.com/abiosoft/caddy-docker/issues/185.
add version=0.11.5 to your build args.
build:
context: github.com/abiosoft/caddy-docker.git
args:
- plugins=cloudflare
- version=0.11.5
I appreciate the reply. That seems to have done the trick for that. Unfortunately though, it doesn't seem to have helped with my original issue. I am trying to simply get Caddy to point to internally hosted applications in Docker but they don't end up working.
After doing the above, I keep getting back a 502 error, before doing the above it was a 521 error I believe. Just to rule out using a .dev domain as being part of the issue I used a .com (both hosted on Cloudflare) but neither worked.
One application is made in Go Buffalo and running in a docker container, and is on port 4569 The other is just a standard phpmyadmin container running on port 4570
I can get to both just fine if I do 123.123.123.123:4569 or 123.123.123.123:4570 (using my real ip, of course)
I have tried everything I can find when it comes to my Caddyfile. Here are a few examples.
First I just had a very basic setup:
mydomain.dev:80 {
proxy / localhost:4569 {
transparent
}
}
I then tried:
mydomain.dev:80 { # <---- I tried with and without a port, as well as *.domain.dev:80, domain.dev:80 and a few other variations of things I found examples of
proxy / localhost:4569 {
transparent
websocket
}
}
I tried changing some things around such as
mydomain.dev:80, mydomain.dev:443 {
proxy / 127.0.0.1:4569 { #(here I also tried http://localhost:4569, http://127.0.0.1:4569, 0.0.0.0:4569, etc )
transparent
websocket
}
}
Where I currently am after scouring the web for more examples to try is this, which of course still doesn't seem to work properly:
mydomain.com:80 {
root /srv/mydomain.com #( <---- this part works at the root of the domain to server normal files)
browse
gzip
tls mydomain.com {
dns cloudflare
}
proxy /blog http://127.0.0.1:4569 { #( <---- this part and the one below still do not work though)
header_upstream X-Forwarded-Host {host}:4569
header_upstream -Origin
header_upstream -Referer
websocket
transparent
}
proxy /admin localhost:4570 {
header_upstream X-Forwarded-Host {host}:4570
header_upstream -Origin
header_upstream -Referer
websocket
transparent
}
log /srv/mydomain.com/logs/access.log {
rotate_size 1
rotate_age 7
rotate_keep 2
}
errors /srv/mydomain.com/logs/error.log {
rotate_size 1
rotate_age 7
rotate_keep 2
}
}
Going to the root of the domain works, which I setup just to make sure it was doing anything at all, so I can view the file browser and a test text file I put in there. /blog is my go application, /admin is phpmyadmin. Neither work though, with or without the header_upstream stuff. I simply added those in because I came across them on a forum post and figured it was worth a try. I know I had something similar in my nginx configs on another server in which these worked, so I thought it might have been necessary.
If anyone has any suggestions, I would definitely love to hear them! Thanks, -MH
I have since tried it with all of these different options with no success:
proxy / localhost:4569 {
transparent
# fail_timeout 0s
# header_upstream Host {host}
# header_upstream X-Real-IP {remote}
# header_upstream X-Forwarded-Ssl on
# header_upstream X-Forwarded-Proto {scheme}
# header_upstream X-Forwarded-Host {host}:4569
# websocket
# header_upstream -Origin
# header_upstream -Referer
# transparent
}
With my current test of simply:
domain.dev {
tls {
dns cloudflare
}
proxy / localhost:4569 {
transparent
}
}
It doesn't come back with an actual 502 error this time, but it does seem to just loop over and over until eventually saying:
The page isn’t redirecting properly
An error occurred during a connection to domain.dev.
This problem can sometimes be caused by disabling or refusing to accept cookies.
So, possible progress I suppose.
Hi, kindly post this in http://caddy.community. It is more suited there.
@abiosoft it is worth noting that Caddy 1.0.0 can be retrieved from the Caddy website with the Cloudflare plugin, so I believe this issue is in fact caused by your build script.
@NEXUS2345 It was fixed with what @abiosoft had mentioned. As soon as I changed it to 11.5 it worked with no problem.
@abiosoft it is worth noting that Caddy 1.0.0 can be retrieved from the Caddy website with the Cloudflare plugin, so I believe this issue is in fact caused by your build script.
I'm not aware of this. I'll verify and work on this. Thanks for pointing it out.
Is the latest release notes relevant?
"KNOWN ISSUE: Building Caddy with plugins is difficult due to the repository move. Our build server has been patched to make it work, but plugin authors will need to update import paths. (Sorry! Unexpected.) I've done my best to file issues with all registered plugins.
from 1.0.1
I can't get the Cloudflare plugin to work in docker either: Restart failed: /etc/Caddyfile:7 - Error during parsing: Unknown DNS provider by name 'cloudflare'
but it works fine if i download Caddy with Cloudflare from their website.
@vlldk it is fixed now.
Just ensure you run docker pull abiosoft/caddy:builder
to get the latest version.
Hello,
I have been trying to add in the cloudflare plugin, as I can't seem to get Caddy to work with with any apps that use a port (docker images such as phpmyadmin, a gobuffalo application I made either in a container or standalone, etc but I can get to them if I just use the ip and port, but not with caddy) for any of my domains which all happen to go through cloudflare, so I was hoping it might help with that.
When I followed the steps I have found, I keep getting:
I tried doing it using this :
As I saw it was mentioned to use no-cache, but that has not helped any. First I tried just replicating a repo I found that had several plugins, that didn't work, so I kept removing them until I got down to just cloudflare, but that still didn't work either. Here was what I added to my docker-compose, which I think was right considering all others I came across looked like this.
Any suggestions would be greatly appreciated.
Thanks,
-MH