# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
lexiverse.vip {
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
sonarr.lexiverse.vip:443 {
reverse_proxy localhost:8989
}
tautulli.lexiverse.vip:443 {
reverse_proxy localhost:8181
}
3. The problem I’m having:
Can't get my dedicated servers ports to go through Caddy and configure it to act as it should. Plus, after the initial setup and trying to make it work, Caddy's default page (the crooked page) no longer shows up at the main domain. I just get "The page isn’t redirecting properly. An error occurred during a connection to lexiverse.vip". Sorry I'm a bit new to this and have been setting it up and figuring my way through.
4. Error messages and/or full log output:
I have no idea how to do this. I enter " journalctl -u caddy --no-pager | less +G" and it gives me 10 walls of text that I cant highlight, copy, or paste.
Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.
5. What I already tried:
I've tried restarts, reloads of the program, reinstalling caddy and reimplementing cloudflare and my domain
You seem to be using Cloudflare’s proxy service, so:
The redirect loop is happing due to a (imho) fairly insecure default called “Flexible SSL”, which sets how Cloudflare decides to connect to your upstream server.
See this very extensive post from 2018, which still applies to this date
But feel free to ask any further questions if you have any
I thought I was supposed to link my domain np. also thank you for responding!
thank you for providing that link, I will check it out and hope it fixes my problem. however I am curious, is the config file/caddyfile right? should it be working, the way its written? Im very new to most of this
ye, but some users just don’t, which makes helping them take more time than necessary and usually requires a lot of back and forth
Your Caddyfile looks good
You could, however, if you want to, remove the trailing :443, since Caddy defaults to that anyway (along with redirects from http:// to https://)
It doesn’t really matter though
I know this is going to be a bit silly of a question, but do you think its recommended to shut off cloudflares reverse proxy and not use the additional features, to make caddy work properly? or should I try to make it work with the steps shown in that post you linked? cause the first step in the caddy default page says “Point your domain’s A/AAAA DNS records at this machine.” so its kind of throwing me off lol
hello again! so I attempted disabling the A and CNAME records and I’m still dealing with the same thing althought the caddy default page is loading now, but no ports or anything. just redirects to the default
Just to clarify, there are two options (and it seems like you decided for the latter by now):
Update how Cloudflare reaches your server in the SSL/TLS → Overview sidebar and select Full (strict) and have your DNS entry’s Proxy status set to Proxied (orange cloud icon)
Disable Cloudflare Proxy by having your DNS entry’s Proxy status set to DNS Only (gray cloud icon)
Your lexiverse.vip (A record) resolves correctly to your server and Caddy serves the index.html in /usr/share/caddy, as expected by your Caddyfile.
Both sonarr.lexiverse.vip and tautulli.lexiverse.vip, however, are CNAMEs and point to Porkbun’s redirect service, which by itself redirects to http://lexiverse.vip:
❯ dog lexiverse.vip
A lexiverse.vip. 2m05s 76.71.143.112
❯ dog sonarr.lexiverse.vip
CNAME sonarr.lexiverse.vip. 3m14s "pixie.porkbun.com."
A pixie.porkbun.com. 1m00s 44.227.65.245
A pixie.porkbun.com. 1m00s 44.227.76.166
❯ dog tautulli.lexiverse.vip
CNAME tautulli.lexiverse.vip. 5m00s "pixie.porkbun.com."
A pixie.porkbun.com. 1m00s 44.227.65.245
A pixie.porkbun.com. 1m00s 44.227.76.166
# http/307 and `Location: http://lexiverse.vip`
❯ curl sonarr.lexiverse.vip -I
HTTP/1.1 307 Temporary Redirect
Server: openresty
Date: Sun, 31 Jul 2022 04:54:12 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 168
Connection: keep-alive
Location: http://lexiverse.vip
X-Frame-Options: sameorigin
You will have to remove those CNAMEs and instead create A records similar to the one in lexiverse.vip.
Or you could keep that CNAMEs, but enter lexiverse.vip instead of pixie.porkbun.com.
That DNS chance may or may not take a while until it is propagated (no longer cached).
I am I won’t be able to reply for a while as it’s getting late for me.
Maybe that points you in the right direction, though. Or someone else will jump in to respond while I am asleep
I think you try to use cloudflares proxy. That means you have to use cloudflares certificate.
That enables cloudflare to decrypt all your traffic and send it over its revere proxy’s.
youre still using a Letsencrypt one