Monday, 15 September 2014

webserver - Why do some servers respond with a 503 error unless my User-Agent starts with "Mozilla"? -


I am writing a client who grabs the page from a web server on a particular server, from my web browser Will work fine, but my code has consistently received response:

  HTTP / 1.1 503 service unavailable content-length: 62 connection: closed cache-control: no-cache, no-store program: no -Cash & lieutenant; Html & gt; & Lt; Body & gt; & Lt; B & gt; HTTP / 1.1 service unavailable & lt; / B & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

I sent it down to the User-Agent header which I was sending: if it contains Mozilla , then everything Ok (I tried many forms of this) If not, I get 503. As soon as I realized it was a user agent, I remembered that this issue was in the past (different projects, different servers), but I have not figured out why

In this particular case, the web server I am connecting to IIS 7.5 is running, but I'm not sure that there is a proxy / firewall / etc in front of it (I suspect there may be

There is an interesting history for user-agents You can read on this question:

This is clearly for me Mozilla in my user-agent, but my question is simply: What is the configuration or server that can be The reason is, and why do you want this behavior?

The main reason for this is that the internet, web and Browsers were not designed, but developed with high volume of backward compatibility, Leck Also, specific extensions for many sellers, especially frames (which are considered quite bad ideas these days) were not well supported by mosaics, but were supported by Netscape (which was as Mozilla's user agent) .

The server administrator had an option: Do they use new hip cool frames and only support Netscape, or do they use old boring pages that everyone can use is? His choice was a hack; If someone tells me that they are Mozilla, send them frames; If not, then do not send them frames.

It ruined everything. IE had to call themselves Mozilla compatible, everyone had a pattern, it is well detailed in the link at the top. But in the modern era, this problem became more or less, because everyone impersonated everyone, and everyone supported the general subset of facilities more and more.

And then the wide spread of mobile browsers and smartphone browsers suddenly, only a few key browsers were originally designed with similar features, and some external browsers that you could easily ignore. Now it was dozens of small browsers, whose low power and low capacity and dissection of capabilities were weird set! And so, many servers took the easy road and did not just send the proper data or any data to any browser they did not recognize.

Now a bad sung or flushing website, you have ... no websites on some platforms, and have done a perfect job on others, but was not tolerable for many businesses ; They wanted to do the right thing on all platforms, because in this way the web was supposed to work.

Mobile version, mobile first, responsive design, media queries, all these were designed to fill those flaws. But for the most part, many websites still disregard less than modern browsers. And the media queries were immediately broken: nobody wants to declare their browser, oh no, we are a real display browser, even if our screen is only 3 inches, yes sir!

In summary, some servers are configured to leave any browser that is not compatible with Mozilla because they think it is

I Some arguments also have seen that it improves security because then the server does not have to deal with rogue programs which are not those browsers connecting to them (much) since it is easy to change user agent, not water for me Is; It's just security by ambiguity.

No comments:

Post a Comment