I use Hugo intesively as a localhost, and I notice it becomes stressed a lot when I edit or replace files.
I always have one browser tab showing my remote server and a few tabs showing the Hugo localhost.
And then localhost starts doing something wrong - like downloading my upload.php to my local Downloads folder - and I suddenly notice that Hugo remote tab is showing my localhost!
It means I had stressed it so much that it has some broken settings inside, that redirected my remote tab to localhost.
Then I have to restart Hugo and delete everything from the Public folder - and it starts working again.
If I was not clear enough - I wanted to say that after a few hours of development Hugo starts mistakenly confusing links.
Suddenly links on the production site start pointing to localhost or vice versa.
What’s the best way to avoid such disruptions and keep Hugo working correctly?
Then how can the remote site “suddenly” show localhost? That has probably nothing to do with Hugo itself – how would a local Hugo server be able to modify your remote site?
Hugo injects a JavaScript with the development server to communicate. Changes to pages and triggering reload.
It might be that your browser viewing all the same stuff in multiple tabs gets confused…
Unable to answer which scenarios should work with the development server, but keep in mind that this is a development server. Maybe with an expected usage of one tab, Maybe a mixed session over hours with lot’s of reloads in many tabs and multiple edits might not be expected usage …
I would start with separating the productive viewing from the development.
use a private tab for the productive site
use private tabs for each tab you open
use an own browser instances for productive and development
use different browsers for production and development
p.s. I hope you do not regenerate your productive site using hugo to the same folder you use with the dev server.
Unlikely – would the browser actually look at the content and find it sufficiently similar to “get confused”? And the server has no idea how many tabs are open to the same content or even site. HTTP is a stateless protocol!
I think the OP should provide much more detail before we go on a wild goose chase.