I use the hugo deploy command to upload to an Azure Blob. That works fine; there are no problems and everything uploads.
But I have an issue with the 404.html
page. When I navigate to a page that doesn’t exist in the Blob, this shows in the browser:
At first I thought, an issue in my configuration. So I double-checked everything and searched through the official documentation and various blog posts. But I didn’t find a mistake.
So I opened a MSDN support question. That discussion didn’t help; everything suggested there I have configured properly.
Then I thought, why not upload the 404.html
through the web browser. To my surprise, that works fine:
My question: how can I make hugo deploy
upload the 404.html
page properly?
Additional details
-
The problem does not happen when I upload the exact same website with the Azure CLI. This means:
- The rendered 404.html code is okay.
- My Azure blob is configured properly.
- The authentication happens correctly.
- There is no issue on Azure’s end.
-
Furthermore:
- Hugo uploads every other file properly (HTML, JavaScript, XML, CSS). There are no files missing.
- The 404 page is the only HTML page that “shows up funny”. Every other file shows at it should. The JavaScript and CSS files are also readable without strange characters.
-
There are no errors when
hugo deploy
runs:
hugo deploy --maxDeletes -1
Deploying to target "____" (azblob://$web)
Identified 7 file(s) to upload, totaling 9.1 kB, and 0 file(s) to delete.
Success!
- This is my deployment configuration:
[deployment]
[[deployment.targets]]
name = "______"
URL = "azblob://$web"
[[deployment.matchers]]
pattern = "^.+\\.(js|css|svg)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = true
[[deployment.matchers]]
pattern = "^.+\\.(png|jpg)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = false
[[deployment.matchers]]
pattern = "^.+\\.(html|xml|json)$"
gzip = true
- I use Hugo 0.64 extended.