“x-ec-custom-error: 1” What does it mean?

心已入冬 提交于 2021-01-29 20:55:45

问题


While studying the HTTP protocol, I saw this in a response header field:

x-ec-custom-error: 1

I was using netcat to get example.com's main page through a proxy connection.

Here is all console comunication where this header appears:

$ nc -x (omitted proxy address):3128 -Xconnect www.example.com 80
GET http://www.example.com/ HTTP/1.1
Host: www.example.com

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=604800
Content-Type: text/html
Date: Fri, 07 Mar 2014 20:08:45 GMT
Etag: "359670651"
Expires: Fri, 14 Mar 2014 20:08:45 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (iad/19AB)
X-Cache: HIT
x-ec-custom-error: 1                                <----------------HERE
Content-Length: 1270

(Omitted message body)

After noticing it, I tried searching thouroughly on google and on this site but I didn't find the answer anywhere, nor did the people who were discussing this with me.

Thanks in advance for all answers.


回答1:


X- prefixed headers are nonstandard headers that are often specific to the particular software in use.

The ECS (iad/19AB) Server header shows that the content is being served by the EdgeCast (now Verizon Digital Media Services) CDN from their IAD (Virginia) point of presence.

The ec in x-ec-custom-error very likely stands for EdgeCast, but the meaning of the header as a whole isn't publicly documented and is probably application-specific.

One theory though is that every possible HTTP status code on example.com is being replaced with a custom error page, and that this header is an indicator of that. So regardless of whether the origin server returns a 200 OK or 404 Not Found, EdgeCast is configured to replace the page contents with a predefined response.

$ curl -i http://example.com/asdfsdfasf
HTTP/1.1 404 Not Found
Server: ECS (oxr/83C7)
X-Cache: HIT
x-ec-custom-error: 1

$ curl -i http://example.com/
HTTP/1.1 200 OK
Server: ECS (ftw/FBE4)
X-Cache: HIT
x-ec-custom-error: 1

(Also, the X-Cache: HIT header tells you that the page was found in EdgeCast's cache and was served directly from them.)



来源:https://stackoverflow.com/questions/22432379/x-ec-custom-error-1-what-does-it-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!