Configure caddyfile to have one site served as http without any encryption?

1. Caddy version (caddy version):

Caddy 2.0

2. How I run Caddy:

Usually by starting the service file I made for systemctl, but in this case for testing purposes I directly use caddy command.

a. System environment:

Ubuntu 18.10 using systemctl

b. Command:

caddy run Caddyfile

d. My complete Caddyfile or JSON config:

www.trior.net trior.net {
    file_server
    root * /home/caddy-webserver/trior.net
    log /home/caddy-webserver/logs/trior.net.log
}
http://www.apotheosis.trior.net:80 http://apotheosis.trior.net:80 {
    file_server
    root * /home/caddy-webserver/apotheosis.trior.net
    log /home/caddy-webserver/logs/apotheosis.trior.net.log
}
www.plexstats.trior.net plexstats.trior.net {
    file_server
    reverse_proxy localhost:15003
}
www.pyload.trior.net pyload.trior.net {
    file_server
    reverse_proxy localhost:8001
}
www.plex.trior.net plex.trior.net {
    file_server
    reverse_proxy localhost:32400
}
www.alandarev.com alandarev.com {
    file_server
    root * /home/alandarev/sites/alandarev.com/www
    log /home/caddy-webserver/logs/alandarev.com.log
}
githubhook.trior.net {
    file_server
    reverse_proxy localhost:3456
}

3. The problem I’m having:

Everything works however what I really want to do is have this one site (www.apotheosis.trior.net)
served only as http and possibly even without any SSL the reason for this is that I want to host a garrysmod loading screen on my webserver, but garrysmod uses a old browser that has issues with redirects or https I’m not exactly sure so I want to try it without any security on that one site.

5. What I already tried:

Not much, I did search the forum here and found some solution on how to do it with json but I gotta tell you guys I’m not an expert in any of this, I’m just now learning how to use caddy v2 and I loved caddy v1 because it was so simple.

6. Links to relevant resources:

What exactly is the problem? You didn’t say.

The only thing I find a bit strange is having :80 at the end of those – it’s redundant because you specify http:// already.

Oh yeah gonna remove those I guess.

I want apotheosis.trior.net stop redirecting to https.

FYI your log directives have the wrong syntax as well. It should be like this:

log {
	output file /var/log/access.log
}

The syntax you’re using was just being silently ignored in v2.0 but will be a parse error in v2.1

But from your Caddyfile, I don’t see how HTTP->HTTPS redirects could be happening. If I try to load that page myself with http://apotheosis.trior.net, it loads just fine with HTTP and no redirect happens.

You can also run curl -v http://apotheosis.trior.net and you’ll see that there’s no Location header to do the HTTP->HTTPS redirect. I don’t see a problem.

1 Like

strange, can it be cache? I tried using dev tools in opera so I don’t use cache guess that did not work…

thanks for the heads up on my syntax :slight_smile:

Yeah, HTTP->HTTPS redirects are permanent, so if your browser saw it once, it will always remember it.

anyway to force it from server side because I can’t expect people to delete their cache.
could I use rewrite?

You can redirect back down.

https://example.com {
  redir http://example.com{uri}
}

http://example.com {
  [...]
}
1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.