0

I'm running a caddy server on a linode instance with debian installed. I'm using the caddy server to proxy to a hugo server. The hugo server works locally, but does not through the caddy server. It will load the content, but style.min.css and the favicons won't load with an error like the following:

GET https://localhost:8081/css/style.min.css net::ERR_CONNECTION_REFUSED

Any help getting this working would be great!

Caddyfile:

mycustomdomain.com {
  root /home/sean/mycustomdomain.com
  gzip
  proxy / localhost:8081
  tls {
    dns linode
  }
}

hugo command:

hugo server --disableLiveReload --port 8081
Busch
  • 857
  • 10
  • 29
  • Why are you proxying to a hugo server, especially without live reload enabled? Why not just let Caddy serve the static files? – Matt Apr 12 '18 at 03:46
  • Is the hugo server actually serving over https? – Toby Allen Apr 12 '18 at 09:58
  • @matt Because hugo is not the only thing I'll be serving up on my linode box. The liveReloading piece is irrelevant to this question. – Busch Apr 12 '18 at 15:45
  • @TobyAllen I was under the impression that hugo automatically served over https, but I'm not sure how to confirm that other than it only says it's serving `Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)` which doesn't appear to be https. – Busch Apr 12 '18 at 15:48
  • Hugo does not serve HTTPS by default. Only Caddy does that. – Matt Apr 13 '18 at 00:49

1 Answers1

2

Figured it out, so answering for posterity:

To resolve this, utilize the http.hugo plugin. The new Caddyfile looks like so:

mycustomdomain.com {
  root /hugo/site/dir/public
  hugo /hugo/site/dir
  gzip
  tls {
    dns linode
  }
}
Busch
  • 857
  • 10
  • 29