Cacheing hell

Really incredible tool

I am running the server in docker on vagrant on windows and plan to deploy in docker on linux (ubuntu)

But I have been having a lot of trouble with cacheing if I use the hugo server or browser differences if I use the nginx server

with the hugo server - watch update the files in public if I change them in linux, but it doesn’t if I change it in windows even though the are shared through a docker volume

even after the files are updated in public the content on the website does not change unless I restart the server - auto refresh seems to happen but the content doesn’t actually change

if I run hugo watch and than serve the content using nginx - I get updated files but the nginx seems to not render correctly on firefox or chrome - only works on ie. Also the auto refresh doesn’t work

The point isn’t to run the Hugo server in production. You would generate the static files and deploy them to be served by nginx. At that point, any caching issues are solely nginx issues, since Hugo finished its job prior to deployment.

Thats the thing - I am not having cacheing issues with nginx - when i use nginx the theme doesn’t get applied correctly

when i use hugo serve the page ends up never changing until i restart the server

What are you running on the command line to start the hugo server?

i was running hugo serve --watch --theme=hyde --buildDrafts --verbose

but now I am just running hugo --watch --theme=hyde --buildDrafts --verbose

and seperately running nginx - i had to add a mim.types file and included that in my conf file and than clear the cached files from chrome - now everything is fine except the auto refresh

I am going to see if this also fixed the issues using the hugo server because tehe auto refresh is really cool

exhausted will update on this tomorrow - thanks for your help

watch does not detect changes made in windows on files shared with hugo

how is it checking for changes?

using serve I have to restart the server to see updates

@Anthony_Louis_Burns we are working on improving Hugo’s behavior on Windows. Would you please file an issue about Hugo not detecting changes made on Windows?

I have experienced some cache refresh issues like you describe. Clearing out the public folder, while not ideal, resolves that. There is an issue https://github.com/spf13/hugo/issues/379 related to this.

There are also requests to add cache-busting to Hugo.

Contributions of all kinds, including issue reports are welcome and appreciated.

Thank you very much just knowing it is actually an issue and its not just me is edifying

@Anthony_Louis_Burns I’m writing this on a Linux PC, but have installed Hugo dev environment in Windows on a second one and I’m looking into a set of Windows related issues, including one that matches yours.

Hang in there - and you will be rewarded in the long run. Hugo is worth it.

Much appreciated - it seems like exactly what I am looking for
Totally new to go though - so its hard for me to tell exactly what is happening when I get unexpected behaviour

@Anthony_Louis_Burns

Contains fixes to your troubles. I have tested the livereloading on Windows, both for content and static files, and it should work fine after/if that PR gets merged into master.

Excellent - I subscribed to watch when this is merged
Not sure how I would apply it otherwise - ?

Well, if you are impatient or want to help test this out - you could just build from my branch. That branch will not get any new updates, but is up-to-date as of today.

Depending on how you have set up your environment, I’m not sure whats easiest, add my repo as a remote (git remote add bjornerik git@github.com:bjornerik/hugo.git) or do a full “clone git@github.com:bjornerik/hugo.git” then check out the windows-fixes branch and build that.

https://github.com/bjornerik/hugo/tree/windows-fixes

Thanks - I just want to confirm - I am running Hugo in a linux virtual machine on windows - will this address my issues

Woops. I did not see that. Then my answer is: I do not thinks so. The fixes I made was for troubles running Hugo in Windows (native).