Caddy invalid redirect, no content shown (using Cloudflare)

Hi, I’m trying to setup my instance of hugo behind Caddy using the plugin http.hugo the problem is that executing caddy -conf config_file the server starts correctly but visiting the website will not show the blog but just a redirection error. Here is the config file: {
        hugo ./0xme / {
                database 123456.db

        tls {
                dns cloudflare
        log ./access.log


0xme is the directory containg hugo

caddy -conf config 
Activating privacy features... done.
WARNING: File descriptor limit 1024 is too low for production servers. At least 8192 is recommended. Fix with "ulimit -n 8192".

I tried a minimal config on two different domains, one with cloudflare and one without, the one with cloudflare gives the redirect error so I’m suspecting it’s a problem with it. Any known issue?

EDIT: fixed setting SSL to Strict in Cloudflare

1 Like

Looks like you got it. For anyone looking for an explanation:

Seems that even with SSL sets to Full(Strict) it still uses the comodo certificate


i use

tls {
   dns cloudflare

in my config

That’s expected behaviour for an orange-cloud domain on Cloudflare. You’re not connecting to Caddy, you’re connecting to CF, who then connect to Caddy on your behalf (over HTTPS).

Any way to let Caddy handle the SSL certificate?

Yes, grey-cloud your domain in Cloudflare’s settings. Cloudflare will then answer DNS requests with the IP address of the origin server (your Caddy server), and clients will connect directly to that instead - thus being served the LetsEncrypt certificate.

Doing this will disable Cloudflare’s protection, caching, and other non-DNS features.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.