1

I have three web servers running identical code. On main, one failover and one development server. Let's call them server1, server2 and server3.

If I load a page from server1, then view the source, the browser reloads the source from the server.

If I load the same page from server2 or server3 they both show the page source without reloading. This is true for both Chromium and Firefox.

The servers are running the same php scripts. They have AFAIK identical nginx/php-fpm installations.

It must be server-side issue because I am using the same browsers in all cases, just changing the IP of the domain from one physical server to another.

What directive could the server be sending to the browser to tell it not to reload? Not an HTTP directive, because there is no difference in the php code from one server to another. I am thinking something at the web server level?

If I reload the page it actually reloads. Only View Source avoids reloading on server2 and server3, which is the behaviour I want. server1 is the one I want to force the browser not to reload on View Source

Edit: I don't believe it is a duplicate because the above question is written by a newbie wanting to know why they can't execute a php script on the client side. The question I have is why does an identical page get reloaded on View Source when it is served by one server but not get reloaded when it is served by a different server? Same browser. Page served by same php code on both servers.

Edit: As to the second "duplicate", thank you for pointing out the post on Firefox. I did read this post when I began researching but the problem affects Chromium as well.

Peter
  • 854
  • 10
  • 19
  • why not inspecting the http headers output of all 3 servers with your browser dev tools to spot the difference ? – Calimero Oct 10 '17 at 15:56
  • Thanks Calimero, that is a good idea. It is also the first thing I did. The HTTP headers are identical in all cases. – Peter Oct 10 '17 at 16:02
  • Instead of exclaiming "_THIS IS NOT A DUPLICATE_", why not _explain_ _how_ it's not a duplicate? – GrumpyCrouton Oct 10 '17 at 16:03
  • 1
    There is nothing server-side which would cause a page to reload when opening 'view source' on the client-side. You're not sending a request to the server, you're only opening the source of what was previously rendered. – Jay Blanchard Oct 10 '17 at 16:05
  • With only one accepted answer during your Stack Overflow history it is suggested that need to get in the habit of [accepting answers](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) which help you to solve your issues. You'll earn points and others will be encouraged to help you. – Jay Blanchard Oct 10 '17 at 16:11
  • GrumpyCourton, I did revise the edit to explain how it is not a duplicate, thanks for pointing this out. @Jay Blanchard, If I understand correctly this cannot happen. But it is happening. Do you have any clues as to what could be causing it? Your statement "only opening the source of what was previously rendered" is not entirely correct. There are many cases where View Source causes a page to reload. The purpose of the question is to determine what could cause the browser to cache or not to cache other than a caching directive or a question mark in the URL. – Peter Oct 10 '17 at 16:17
  • I have never seen a case where opening view source causes a request to a browser. Can you provide an example? – Jay Blanchard Oct 10 '17 at 16:18
  • I found a case specific to FF https://stackoverflow.com/questions/611617/can-firefoxs-view-source-be-set-to-not-make-a-new-get-request – Jay Blanchard Oct 10 '17 at 16:21
  • I will see if I can reproduce the issue on a test site. – Peter Oct 10 '17 at 17:37
  • There is a php script at http://nip.yt/vsreload.php which generates a random string and displays it. When I view source, the string changes demonstrating that the page was reloaded. I have tried this in Chromium and Firefox on Linux and on Chromium on Windows 10. In all of these browsers, a reload occurs when View Source is chosen. – Peter Oct 11 '17 at 13:43

0 Answers0