Hugo 0.18.1 not working with Caddy 0.9.4

Hello everyone, happy new year. So I want to move to caddy and hugo. I downloaded caddy 0.9.4 with hugo support. The following is what I have so far:

Caddyfile {
root /var/www/tdc
hugo /var/www/tdc --bind
log stdout
errors {
log stderr
404 404.html

And the config.toml for Hugo is

baseurl = “
title = “Academic Theme”
copyright = “© 2017 The Developer Club”
theme = “academic”
enableEmoji = true

For the hugo theme am using Academic Theme because all other themes are giving parse errors. They fail with some kind of partial/head.html error or index.html issue. I am assuming it is because of some version changes for hugo 0.18.1

Now the issue is this:

  1. When I start the service from caddy, it starts correctly but does not execute hugo. So the page only shows a “404 not found” text.

  2. If I start hugo manually it works but I have to run it exactly like so and it only works through the domain with the port assigned, instead of with the domain alone (without using a port).

hugo server --theme=academic --bind= --port=8080

What I would like, and please correct me since this is my first time toying with this:

  1. Start caddy which also starts hugo.
  2. Access the hugo site (with the theme) via the instead of or any other port
  3. The site should be https

If there is ANY information that is needed here to explain better, please let me know so I can join the ranks little by little of using caddy and hugo (And understand them better). Thank you.

Hello @luisalvarado,

Hugo plugin developer here. Sorry from hearing that but you don’t seem to use the directive specification. Take a look at the docs please :slight_smile:

Here is what I suggest for your Caddyfile: {
    root /var/www/tdc/public
    hugo /var/www/tdc {
        flag bind
    basicauth /admin username password
    log stdout
    errors {
        log stderr
        404 404.html

The root is the public folder where the site is generated and not the folder where your hugo configuration is.

The hugo directive will provide an admin interface at /admin. That interface is protected with the username and password provided within the basicauth directive.

Hope it helps! Try it :smiley:

1 Like

I just do not know what to say. First am humbled and amazed that the creator answered. And that answered the issue altogether. I have this final questions to get into grip with this plugin:

  1. Do options have to be in a certain order or do some depend on others? Like gzip needs to be first or before something.
  2. How can I help in extending the documentation on that page you pointed me to, to add more examples. It is just that, coming from an apache, nginx thinking to here is a bit confusing.
  3. Is the username password just placeholders to put the real user and password? something like /admin peter carry1x where peter is the user and carry1x is the password?
  4. Where can I find a full list of all options available here. I found this The Caddyfile — Caddy Documentation but the way it is explained confused me in the beginning and I do not know if this are all supported directives (Again, confuse).

Thank you Henrique and have an amazing new year!

Nope, that’s taken care of for you.

You can submit a PR to - I’ll have @hacdias look it over.


Available for the whole Caddyfile? Or the hugo plugin only?

1 Like

Thank you for the answers. For this case, it would be both at best I believe. To have like a starting sheet cheat of understanding (An entry level) how both work (The Caddyfile and the config.toml)

The directives available for the Caddyfile are at Welcome — Caddy Documentation in the sidebar, and the configuration for the hugo plugin (separate thing from the hugo binary) is at


Thank you Matt and Henrique. Amazing support.


You’re welcome @luisalvarado :slight_smile:

I just updated to Hugo 0.18.1 and Caddy 0.9.4. I had a working Caddy 0.9.3 version that works great. When I switched to 0.9.4 I cannot add new content or publish themes/sites although the admin console is available.

It also seemed like it hung my Caddy server so I had to restart. I rolled back to 0.9.3 and it works great still. Any ideas?


Just to confirm that is not just me. Are you able to change and save anything in the front-end admin or can you only see the information but can’t save anything? I am having this issue as well. To change theme what I am doing is literally copying their content to the root directory, overwriting everything there and then changing it to my liking because calling the theme like on previous versions is not working.

I thought it was done like this because the other ways did not work.

If I edit my config file (changing the theme name) and save it that seems fine. If I press Publish I get the busy indicator that never goes away and on the back end the site does not get regenerated.

If I go to the content/post directory and do a new post and put in a file name it does the same thing–busy indicator but no new file made on the server. I haven’t tried editing and publishing an existing post–I’ll try that and let you know if that works.

That’s all I’ve noticed. I haven’t tried to git a new theme. I’ll try that too.

Still not working for me. I can see existing files, even edit my config and that saves ok. But it does not publish or regenerate the page.

I also tried to git a new theme. It gave me the busy indicator but it did not download the theme.

Looks like I’m going back to 0.9.3 till it is fixed ;(

This is exactly what happens to me on the latest versions (Hugo 0.18.1 and Caddy 0.9.4). So you believe it is caddy the issue?

Hello @luisalvarado @hudware,

Could any of you open the Console in the Developer Tools of your browser to check if there is any error in there please?

I opened up Chromium developer tools and tried to add a new post. I got this javascript error.

Uncaught ReferenceError: token is not defined
at HTMLInputElement.document.getElementById.addEventListener.event (application.js:43)

When I clicked publish on the config page I got the following error:

application.js:120 Uncaught ReferenceError: token is not defined
at HTMLButtonElement.document.getElementById.addEventListener.event (application.js:120)

Hope that helps.


1 Like

Thanks @hudware! I’ll check that today but it will not be available to download at immediately.

When I try to git a theme I get these two errors:

application.js:499 Mixed Content: The page at ‘’ was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint ‘ws://’. This request has been blocked; this endpoint must be available over WSS.
searchEvent @ application.js:499
application.js:499 Uncaught DOMException: Failed to construct ‘WebSocket’: An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
at HTMLInputElement.searchEvent (

No worries. Thank you for your help. Keep up the good work.

Hey again! :open_mouth: I didn’t knew that the websockets needed to be over HTTPS too. I’ll fix that as soon as I can. Sorry.

This is from Chrome

1 Like