• Http协议规范及格式


    HTTP(HyperTextTransferProtocol)是超文本传输协议的缩写,它用于传送WWW方式的数据,关于HTTP协议的详细内容请参考RFC2616。HTTP协议采用了请求/响应模型。客户端向服务器发送一个请求,请求头包含请求的方法、URI、协议版本、以及包含请求修饰符、客户信息和内容的类似于MIME的消息结构。服务器以一个状态行作为响应,相应的内容包括消息协议的版本,成功或者错误编码加上包含服务器信息、实体元信息以及可能的实体内容。

    通常HTTP消息包括客户机向服务器的请求消息和服务器向客户机的响应消息。这两种类型的消息由一个起始行,一个或者多个头域,一个只是头域结束的空行和可选的消息体组成。HTTP的头域包括通用头,请求头,响应头和实体头四个部分。每个头域由一个域名,冒号(:)和域值三部分组成。域名是大小写无关的,域值前可以添加任何数量的空格符,头域可以被扩展为多行,在每行开始处,使用至少一个空格或制表符。

    通用头域

    通用头域包含请求和响应消息都支持的头域,通用头域包含Cache-Control、Connection、Date、Pragma、Transfer- Encoding、Upgrade、Via。对通用头域的扩展要求通讯双方都支持此扩展,如果存在不支持的通用头域,一般将会作为实体头域处理。下面简单介绍几个在UPnP消息中使用的通用头域。

    Cache-Control头域

    Cache-Control指定请求和响应遵循的缓存机制。在请求消息或响应消息中设置Cache-Control并不会修改另一个消息处理过程中的缓存处理过程。请求时的缓存指令包括no- cache、no-store、max-age、max-stale、min-fresh、only-if-cached,响应消息中的指令包括 public、private、no-cache、no-store、no-transform、must-revalidate、proxy- revalidate、max-age。各个消息中的指令含义如下:

    Public指示响应可被任何缓存区缓存。

    Private指示对于单个用户的整个或部分响应消息,不能被共享缓存处理。这允许服务器仅仅描述当用户的部分响应消息,此响应消息对于其他用户的请求无效。

    no-cache指示请求或响应消息不能缓存

    no-store用于防止重要的信息被无意的发布。在请求消息中发送将使得请求和响应消息都不使用缓存。

    max-age指示客户机可以接收生存期不大于指定时间(以秒为单位)的响应。

    min-fresh指示客户机可以接收响应时间小于当前时间加上指定时间的响应。

    max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值,那么客户机可以接收超出超时期指定值之内的响应消息。

    Date头域

    Date头域表示消息发送的时间,时间的描述格式由rfc822定义。例如,Date:Mon,31Dec200104:25:57GMT。Date描述的时间表示世界标准时,换算成本地时间,需要知道用户所在的时区。

    Pragma头域

    Pragma头域用来包含实现特定的指令,最常用的是Pragma:no-cache。在HTTP/1.1协议中,它的含义和Cache-Control:no-cache相同。

    请求消息

    请求消息的第一行为下面的格式:

    MethodSPRequest- URISPHTTP-VersionCRLFMethod表示对于Request-URI完成的方法,这个字段是大小写敏感的,包括OPTIONS、 GET、HEAD、POST、PUT、Delete、TRACE。方法GET和HEAD应该被所有的通用WEB服务器支持,其他所有方法的实现是可选的。 GET方法取回由Request-URI标识的信息。HEAD方法也是取回由Request-URI标识的信息,只是可以在响应时,不返回消息体。 POST方法可以请求服务器接收包含在请求中的实体信息,可以用于提交表单,向新闻组、BBS、邮件群组和数据库发送消息。

    SP表示空格。Request-URI遵循URI格式,在此字段为星号(*)时,说明请求并不用于某个特定的资源地址,而是用于服务器本身。HTTP- Version表示支持的HTTP版本,例如为HTTP/1.1。CRLF表示换行回车符。请求头域允许客户端向服务器传递关于请求或者关于客户机的附加信息。请求头域可能包含下列字段Accept、Accept-Charset、Accept-Encoding、Accept-Language、 Authorization、From、Host、If-Modified-Since、If-Match、If-None-Match、If- Range、If-Range、If-Unmodified-Since、Max-Forwards、Proxy-Authorization、 Range、Referer、User-Agent。对请求头域的扩展要求通讯双方都支持,如果存在不支持的请求头域,一般将会作为实体头域处理。

    典型的请求消息:

    GET http://download.microtool.de:80/somedata.exe

    Host:download.microtool.de

    Accept:*/*

    Pragma:no-cache

    Cache-Control:no-cache

    Referer:http://download.microtool.de/

    User-Agent:Mozilla/4.04[en](Win95;I;Nav)

    Range:bytes=554554-

    上例第一行表示HTTP客户端(可能是浏览器、下载程序)通过GET方法获得指定URL下的文件。棕色的部分表示请求头域的信息,绿色的部分表示通用头部分。

    Host头域

    Host头域指定请求资源的Intenet主机和端口号,必须表示请求url的原始服务器或网关的位置。HTTP/1.1请求必须包含主机头域,否则系统会以400状态码返回。

    Referer头域

    Referer 头域允许客户端指定请求uri的源资源地址,这可以允许服务器生成回退链表,可用来登陆、优化cache等。他也允许废除的或错误的连接由于维护的目的被追踪。如果请求的uri没有自己的uri地址,Referer不能被发送。如果指定的是部分uri地址,则此地址应该是一个相对地址。

    Range头域

    Range头域可以请求实体的一个或者多个子范围。例如,

    表示头500个字节:bytes=0-499

    表示第二个500字节:bytes=500-999

    表示最后500个字节:bytes=-500

    表示500字节以后的范围:bytes=500-

    第一个和最后一个字节:bytes=0-0,-1

    同时指定几个范围:bytes=500-600,601-999

    但是服务器可以忽略此请求头,如果无条件GET包含Range请求头,响应会以状态码206(PartialContent)返回而不是以200(OK)。

    User-Agent头域

    User-Agent头域的内容包含发出请求的用户信息。

    响应消息

    响应消息的第一行为下面的格式:

    HTTP-VersionSPStatus-CodeSPReason-PhraseCRLF

    HTTP- Version表示支持的HTTP版本,例如为HTTP/1.1。Status-Code是一个三个数字的结果代码。Reason-Phrase给 Status-Code提供一个简单的文本描述。Status-Code主要用于机器自动识别,Reason-Phrase主要用于帮助用户理解。 Status-Code的第一个数字定义响应的类别,后两个数字没有分类的作用。第一个数字可能取5个不同的值:

    1xx:信息响应类,表示接收到请求并且继续处理

    2xx:处理成功响应类,表示动作被成功接收、理解和接受

    3xx:重定向响应类,为了完成指定的动作,必须接受进一步处理

    4xx:客户端错误,客户请求包含语法错误或者是不能正确执行

    5xx:服务端错误,服务器不能正确执行一个正确的请求

    响应头域允许服务器传递不能放在状态行的附加信息,这些域主要描述服务器的信息和Request-URI进一步的信息。响应头域包含Age、 Location、Proxy-Authenticate、Public、Retry-After、Server、Vary、Warning、WWW- Authenticate。对响应头域的扩展要求通讯双方都支持,如果存在不支持的响应头域,一般将会作为实体头域处理。

    典型的响应消息:

    HTTP/1.0200OK

    Date:Mon,31Dec200104:25:57GMT

    Server:Apache/1.3.14(Unix)

    Content-type:text/html

    Last-modified:Tue,17Apr200106:46:28GMT

    Etag:"a030f020ac7c01:1e9f"

    Content-length:39725426

    Content-range:bytes554554-40279979/40279980

    上例第一行表示HTTP服务端响应一个GET方法。棕色的部分表示响应头域的信息,绿色的部分表示通用头部分,红色的部分表示实体头域的信息。

    Location响应头

    Location响应头用于重定向接收者到一个新URI地址。

    Server响应头

    Server响应头包含处理请求的原始服务器的软件信息。此域能包含多个产品标识和注释,产品标识一般按照重要性排序。

    实体

    请求消息和响应消息都可以包含实体信息,实体信息一般由实体头域和实体组成。实体头域包含关于实体的原信息,实体头包括Allow、Content- Base、Content-Encoding、Content-Language、Content-Length、Content-Location、 Content-MD5、Content-Range、Content-Type、Etag、Expires、Last-Modified、 extension-header。extension-header允许客户端定义新的实体头,但是这些域可能无法未接受方识别。实体可以是一个经过编码的字节流,它的编码方式由Content-Encoding或Content-Type定义,它的长度由Content-Length或 Content-Range定义。

    Content-Type实体头

    Content-Type实体头用于向接收方指示实体的介质类型,指定HEAD方法送到接收方的实体介质类型,或GET方法发送的请求介质类型Content-Range实体头

    Content-Range实体头用于指定整个实体中的一部分的插入位置,他也指示了整个实体的长度。在服务器向客户返回一个部分响应,它必须描述响应覆盖的范围和整个实体长度。一般格式:

    Content-Range:bytes-unitSPfirst-byte-pos-last-byte-pos/entity-legth

    例如,传送头500个字节次字段的形式:Content-Range:bytes0-499/1234如果一个http消息包含此节(例如,对范围请求的响应或对一系列范围的重叠请求),Content-Range表示传送的范围,Content-Length表示实际传送的字节数。

    Last-modified实体头

    Last-modified实体头指定服务器上保存内容的最后修订时间。

    HTTP协议(RFC2616)方法定义

    OPTIONS

    OPTIONS 方法表示在由 Request-URI 标识的请求/响应链上关于有效通迅选项信息的请
    求。该方法允许客户端判断与某个资源相关的选项和/或需求或者服务器的能力,而不需要
    采用资源行为或发起资源获取。
     
        该方法的响应不能缓存。
     
        如果OPTIONS请求包括实体(如由 Content-Length或 Transfer-Encoding的存在表示),
    这时媒体类型必须通过 Content-Type 域表示。尽管本规范没有定义该实体的用法,将来的
    HTTP 扩展可能使用 OPTIONS 消息体来更详细地查询服务器的信息。服务器不支持该扩展
    可以丢弃该请求消息体。
     
        如果 Request-URI 是星号(“*”),OPTIONS 请求通常试图应用于服务器而不是特定的
    资源。由于服务器的通迅选项一般由资源决定,所以“*”请求只作为“ping”或“no-op”
    类型的方法有用;它没有任何作用,除了允许客户端测试服务器的能力。例如,可用来测试
    HTTP/1.1 代理的一致性(或缺少因素)。
     
        如果 Request-URI不是星号,OPTIONS请求只应用于与该资源通迅时的有效选项。
     
         200 响应应该包括任何头部域来表示服务器实现和可应用到该资源的可选特性(如
    Allow),可能包括该规范没有定义的扩展。如果有响应消息体,则应该还包括通迅选项的信
    息。本规范没有定义该消息体的格式,但可能在将来扩展 HTTP时定义。内容协商可用于选
    择适当的响应格式。如果不包括响应消息体,则响应必须包括域值为“0”的 Content-Length
    域。
     
         Max-Forwards 请求头部域可能用于请求链中定位特定代理。当代理收到关于允许请求
    转发的absoluteURI的OPTIONS请求时, 代理必须检查Max-Forwards域。 如果Max-Forwards
    域值为0(“0” ),则代理不能转发该消息;取而代之,代理应该以它自己的通迅选项来响应。
    如果 Max-Forwards 域值是大于 0 的整数,代理在转发该请求时必须将域值减一。如果请求
    中不存在 Max-Forwards域,则转发的请求中不能包括Max-Forwards域。

    GET

        GET 方法即获取由 Request-URI 标识的任何信息(以实体的形式)。如果 Request-URI
    引用某个数据处理过程,则应该以它产生的数据作为在响应中的实体,而不是该过程的源代
    码文本,除非该过程碰巧输出该文本。

        如果请求消息包括 If-Modified-Since、If-Unmodified-Since、If-Match、If-None-Match或
    者If-Range头部域,则GET方法的语义变为“条件GET”。条件 GET方法请求只传输在条
    件头部域描述情形下的实体。条件 GET 方法试图通过允许刷新缓存的实体而不需要多次请
    求或传输客户端已经拥有的数据来减少非必要的网络使用。 
        如果请求消息包括 Range头部域,则 GET方法的语义变为“局部 GET”。局部 GET请
    求只需传输实体的某部分。

    HEAD

        除了服务器不能在响应中返回消息体,HEAD 方法与 GET 相同。HEAD 请求的响应中
    的 HTTP 头部中包含的元信息应该与 GET 请求发送的响应中的信息相同。该方法可用来获
    取请求暗示实体的元信息, 而不需要传输实体本身。 该方法常用来测试超文本链接的有效性、
    可用性和最近的修改。
     
        当响应中包含的信息可用于更新先前从该资源缓存的实体时, HEAD 请求的响应可能是
    可缓冲的。如果新的域值表明该缓冲的实体与当前实体不同(如可通过 Content-Length、
    Content-MD5、ETag或Last-Modified的区别来表示),这时缓冲服务器必须将该缓存实体作
    为过期的。

    POST

         POST 方法用来请求原始服务器接受请求中封装的实体作为从属于请求行中的
    Request-URI标识的副属。POST设计允许完成下列功能的统一方法:
     
         * 注解存在资源;
         * 上传消息到论坛、新闻组或相似的讨论组;
         * 向数据处理过程提供数据块,如递交表单的结果;
         * 通过追加操作来扩展数据库。
     
         POST 方法执行的实际功能由服务器决定,且通常取决于 Request-URI。上传的实体从
    属于该URI,通过文件从属于包含它的目录,新的论文从属于它上传的新闻组,或记录从属
    于数据库的方式。
     
         POST 方法执行的行为可能不导致通过 URI 能够标识的某个资源。在这种情况下,200
    (OK)或 204(No Content)都是适合的响应状态。这取决于描述结果的响应是否包括实体。 
     
        如果原始服务器创建了资源,响应应该是 201(Created),且包含描述请求状态的实体,

    和新资源的引用,和Location头部。

     
        该方法的响应不能缓存,除非响应包括适当的Cache-Control或 Expires头部域。然而,
    303(See Other)响应能够用来引导用户代理获取可缓存的资源。

    PUT

         PUT方法请求以提供的Request-URI存储封装的实体。如果 Request-URI引用已经存在
    的资源,该封装实体应该被认作原始服务器存储的修改版本。如果 Request-URI没有指向已
    存在的资源, 且该URI可以被请求的用户代理定义为新的资源, 则原始服务器可以用该 URI
    创建资源。如果创建了新的资源,则原始服务器必须通过 201(Created)响应提示用户代理。
    如果修改了已存在的资源,则应该发送200(OK)或 204(No Content)响应代码来表示成
    功完成了请求。如果不能按 Request-URI创建或修改资源,则应该给出适当的错误响应以反
    映出问题的性质。实体的接受方不能乎略任何不理解或没有实现的 Content-*(如
    Content-Range)头部,在这种情况下必须返回 501(Not Implemented)响应。
     
        如果请求通过缓冲服务器且Request-URI标识出一个或多个缓冲的实体,则应该认为这
    些实体过期了。该方法的响应不可缓存。
     
         POST和PUT请求间的基本区别反映在 Request-URI的不同意义。POST请求中 URI标
    识的资源将处理封装的实体。该资源可能是数据接收过程、其它协议的网关或接受注解的独
    立实体。与此对应,PUT请求中的URI标识请求封装的实体——用户代理知道该 URI是目
    标且服务器不能试图将该请求应用到其它资源上。 如果服务器希望该请求应用到不同的 URI
    上,则它必须发送301(Moved Permanently)请求;这时客户代理可以自己决定是否要重定
    向该请求。
     
        可以用许多不同的 URI 标识同个资源。例如,一篇文章可以有标识为“当前版本”的
    URI,它独立于标识每个特别版本的 URI。在这种情况下,使用通用 URI 的 PUT 请求可能
    造成原始服务器定义的一些不同URI的结果。
     
         HTTP/1.1 没有定义PUT方法如何影响原始服务器的状态。 
     
        除了其它特殊实体头部的规定,PUT 请求中的实体头部应该应用到 PUT 创建或修改的
    资源上。

    DELETE

         DELETE 方法请求原始服务器删除Request-URI 标识的资源。原始服务器可在人为干涉

    下(或其它意思)屏闭该方法。客户端不能确保该操作已经提交,即使原始服务器发出的状
    态码表明动作已经成功完成也如此。然而,在给出响应的时候,服务器不应该表示成功,除
    非它试图删除该资源或将它移动到不可访问的位置。
     
        如果响应包含描述状态的实体,成功响应应该是200(OK)。如果动作没有实施,则是
    202(Accepted)。如果动作已经实施但响应不包含实体,则是 204(No Content)。
     
        如果请求通过缓冲服务器,且Request-URI标识一个或多个当前缓存的实体,则应该认
    为这些实体已经过期。该方法的响应不可缓存。

    TRACE

         TRACE 方法用于引起远程的,该请求消息的应用层回射。请求的最终接收者应该反射
    200(OK)响应,并以该消息作为客户端回收消息的实体。最终接收者是原始服务器或第一
    个收到请求中的Max-Forwards值为0(0)的代理或网关。TRACE 请求不能
    包括实体。
     
         TRACE 允许客户端看见请求链上的另一端收到了什么,然后使用该数据作为测试或诊
    断信息。Via 头部域的值有特殊作用,将它作为请求链路径。使用Max-Forwards
    头部域允许客户端限制请求链的长度,这对于测试无限循环转发消息的代理链非常有用。
     
        如请求有效,则响应应该在实体中包含整个请求消息,设置 Content-Type 为
    “message/http” 。该方法的响应不能缓存。

    CONNECT

        规范保留 CONNECT 方法名。该方法用于代理,使之能够动态切换隧道(例如 SSL
    隧道)。

     

     

     

    Requests

     

    Field name↓DescriptionExample
    Accept Content-Types that are acceptable Accept: text/plain
    Accept-Charset Character sets that are acceptable Accept-Charset: utf-8
    Accept-Encoding Acceptable encodings Accept-Encoding: <compress | gzip | identity>
    Accept-Language Acceptable languages for response Accept-Language: en-US
    Accept-Ranges Allows the server to indicate its acceptance of range requests for a resource Accept-Ranges: bytes
    Authorization Authentication credentials for HTTP authentication Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
    Cache-Control Used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain Cache-Control: no-cache
    Connection What type of connection the user-agent would prefer Connection: close
    Cookie an HTTP cookie previously sent by the server with Set-Cookie (below) Cookie: $Version=1; Skin=new;
    Content-Length The length of the request body in octets (8-bit bytes) Content-Length: 348
    Content-Type The mime type of the body of the request (used with POST and PUT requests) Content-Type: application/x-www-form-urlencoded
    Date The date and time that the message was sent Date: Tue, 15 Nov 1994 08:12:31 GMT
    Expect Indicates that particular server behaviors are required by the client Expect: 100-continue
    From The email address of the user making the request From: user@email.com
    Host The domain name of the server (for virtual hosting), mandatory since HTTP/1.1 Host: en.wikipedia.org
    If-Match Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource if it has not been modified since the user last updated it. If-Match: "737060cd8c284d8af7ad3082f209582d"
    If-Modified-Since Allows a 304 Not Modified to be returned if content is unchanged If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
    If-None-Match Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag If-None-Match: "737060cd8c284d8af7ad3082f209582d"
    If-Range If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity If-Range: "737060cd8c284d8af7ad3082f209582d"
    If-Unmodified-Since Only send the response if the entity has not been modified since a specific time. If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
    Max-Forwards Limit the number of times the message can be forwarded through proxies or gateways. Max-Forwards: 10
    Pragma Implementation-specific headers that may have various effects anywhere along the request-response chain. Pragma: no-cache
    Proxy-Authorization Authorization credentials for connecting to a proxy. Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
    Range Request only part of an entity. Bytes are numbered from 0. Range: bytes=500-999
    Referer This is the address of the previous web page from which a link to the currently requested page was followed. Referer: http://en.wikipedia.org/wiki/Main_Page
    TE The transfer encodings the user agent is willing to accept: the same values as for the response header Transfer-Encoding can be used, plus the "trailers" value (related to the "chunked" transfer method) to notify the server it accepts to receive additional headers (the trailers) after the last, zero-sized, chunk. TE: trailers, deflate;q=0.5
    Upgrade Ask the server to upgrade to another protocol. Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
    User-Agent The user agent string of the user agent User-Agent: Mozilla/5.0 (Linux; X11)
    Via Informs the server of proxies through which the request was sent. Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
    Warning A general warning about possible problems with the entity body. Warning: 199 Miscellaneous warning

    [edit] Responses

     

    Field name↓DescriptionExample
    Accept-Ranges What partial content range types this server supports Accept-Ranges: bytes
    Age The age the object has been in a proxy cache in seconds Age: 12
    Allow Valid actions for a specified resource. To be used for a 405 Method not allowed Allow: GET, HEAD
    Cache-Control Tells all caching mechanisms from server to client whether they may cache this object Cache-Control: no-cache
    Content-Encoding The type of encoding used on the data Content-Encoding: gzip
    Content-Language The language the content is in Content-Language: da
    Content-Length The length of the response body in octets (8-bit bytes) Content-Length: 348
    Content-Location An alternate location for the returned data Content-Location: /index.htm
    Content-Disposition An opportunity to raise a "File Download" dialogue box for a known MIME type Content-Disposition: attachment; filename=fname.ext
    Content-MD5 A Base64-encoded binary MD5 sum of the content of the response Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==
    Content-Range Where in a full body message this partial message belongs Content-Range: bytes 21010-47021/47022
    Content-Type The mime type of this content Content-Type: text/html; charset=utf-8
    Date The date and time that the message was sent Date: Tue, 15 Nov 1994 08:12:31 GMT
    ETag An identifier for a specific version of a resource, often a Message Digest, see ETag ETag: "737060cd8c284d8af7ad3082f209582d"
    Expires Gives the date/time after which the response is considered stale Expires: Thu, 01 Dec 1994 16:00:00 GMT
    Last-Modified The last modified date for the requested object, in RFC 2822 format Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
    Location Used in redirection, or when a new resource has been created. Location: http://www.w3.org/pub/WWW/People.html
    Pragma Implementation-specific headers that may have various effects anywhere along the request-response chain. Pragma: no-cache
    Proxy-Authenticate Request authentication to access the proxy. Proxy-Authenticate: Basic
    Refresh Used in redirection, or when a new resource has been created. This refresh redirects after 5 seconds.
    (This is a proprietary/non-standard header extension introduced by Netscape and supported by most web browsers.)
    Refresh: 5; url=http://www.w3.org/pub/WWW/People.html
    Retry-After If an entity is temporarily unavailable, this instructs the client to try again after a specified period of time. Retry-After: 120
    Server A name for the server Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)
    Set-Cookie an HTTP cookie Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1
    Trailer The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding. Trailer: Max-Forwards
    Transfer-Encoding The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity. Transfer-Encoding: chunked
    Vary Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server. Vary: *
    Via Informs the client of proxies through which the response was sent. Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
    Warning A general warning about possible problems with the entity body. Warning: 199 Miscellaneous warning
    WWW-Authenticate Indicates the authentication scheme that should be used to access the requested entity. WWW-Authenticate: Basic

    [edit] Common non-standard headers

    Non-standard headers can be used, with the convention of prefixing the header name with X- .[1]

     

    Field name↓DescriptionExample
    X-Frame-Options[2] Clickjacking protection. DENY - no rendering within a frame, SAMEORIGIN - no rendering if origin mismatch X-Frame-Options: DENY
    X-XSS-Protection[citation needed] Cross-site scripting (XSS) filter X-XSS-Protection: 1; mode=block
    X-Requested-With[3] mainly used to identify Ajax requests. Most JavaScript frameworks send this header with value of XMLHttpRequest X-Requested-With: XMLHttpRequest
    X-Forwarded-For[4] a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer X-Forwarded-For: client1, proxy1, proxy2
    X-Forwarded-Proto[citation needed] a de facto standard for identifying the originating protocol of an HTTP request, since a reverse proxy (load balancer) communicates with a web server using HTTP X-Forwarded-Proto: https
  • 相关阅读:
    IDEA启动tomcat乱码
    RowKey设计之单调递增行键/时序数据
    ES入门REST API
    WebSocket-java实践
    Linux(CentOS 7)安装测试mysql5.6服务
    Linux(CentOS 7)安装测试svn服务
    Node.js安装及环境配置之Windows篇---完美,win7已测
    Java配置----JDK开发环境搭建及环境变量配置
    手把手教新手小白在window把自己的项目上传到github
    github常见操作和常见错误!错误提示:fatal: remote origin already exist
  • 原文地址:https://www.cnblogs.com/kabi/p/6281622.html
Copyright © 2020-2023  润新知