2

I'm setting up a local development server on my Mac using nginx in place of Apache. I'm basically there, but having one issue.

I have multiple web apps, and each are set up using sites-available and sites-enabled - no issues here. The issue is that my browser of choice is chrome, and there's some weird caching going on that is causing the first-visited app to load each time. For example, I have:

site1.dev site2.dev

If I load site1.dev, it loads without issue. If I load site2.dev, it's automatically redirected to site1.dev. I see this as a caching issue because if I use chrome's Incognito mode, I don't have the same issues (nor do I have them in Firefox).

Does anyone know what could be going on here? Or what the solution could be? Thanks in advance!

4
  • 1
    Open the dev tools in chrome and disable caching there, reload the site1.dev, if it then does not redirect enable caching again and close the dev tools. At this time the cached redirect should be gone. Commented Nov 16, 2015 at 17:54
  • Thanks - this seems to have done the trick. It seems as though each time I add a new development site, I'm going to have to do the same thing (disable caching in Chrome's DevTools and re-enable). This isn't a huge deal, but would be better if it could be avoidable! Commented Nov 16, 2015 at 18:02
  • 1
    Chrome will only do the redirect from cache if you once loaded that page with the redirect beeing active. Commented Nov 16, 2015 at 18:08
  • Makes sense, thanks again! Commented Nov 16, 2015 at 18:09

1 Answer 1

6

The solution is to open Chrome's Dev tools (right click, inspect element), click the network tab, and disable caching. Reload the first url, and try the second url. If there is no redirect, disable caching, and the issue is resolved.

Chrome only redirects from cache if the page was initially loaded with caching enabled.

Sign up to request clarification or add additional context in comments.

2 Comments

If you're trying to figure out why your local .dev site isn't loading like I was, google made a commit redirecting all sites with a .dev extension to https. I thought it was chrome's cache being unkillable, but it's just a hardcoded thing in the browser now.
I'm using chromium and cache is disabled in devtools, but my app still caches. I can only get new version if I clear cache in chromium, but that sucks. Never had this problem before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.