| < draft-ietf-httpbis-bcp56bis-01.txt | draft-ietf-httpbis-bcp56bis-02.txt > | |||
|---|---|---|---|---|
| HTTP M. Nottingham | HTTP M. Nottingham | |||
| Internet-Draft February 12, 2018 | Internet-Draft February 28, 2018 | |||
| Obsoletes: 3205 (if approved) | Obsoletes: 3205 (if approved) | |||
| Intended status: Best Current Practice | Intended status: Best Current Practice | |||
| Expires: August 16, 2018 | Expires: September 1, 2018 | |||
| On the use of HTTP as a Substrate | On the use of HTTP as a Substrate | |||
| draft-ietf-httpbis-bcp56bis-01 | draft-ietf-httpbis-bcp56bis-02 | |||
| Abstract | Abstract | |||
| HTTP is often used as a substrate for other application protocols. | HTTP is often used as a substrate for other application protocols. | |||
| This document specifies best practices for these protocols' use of | This document specifies best practices for these protocols' use of | |||
| HTTP. | HTTP. | |||
| Note to Readers | Note to Readers | |||
| Discussion of this draft takes place on the HTTP working group | Discussion of this draft takes place on the HTTP working group | |||
| skipping to change at page 1, line 43 ¶ | skipping to change at page 1, line 43 ¶ | |||
| Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
| Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
| working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
| Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
| Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| This Internet-Draft will expire on August 16, 2018. | This Internet-Draft will expire on September 1, 2018. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2018 IETF Trust and the persons identified as the | Copyright (c) 2018 IETF Trust and the persons identified as the | |||
| document authors. All rights reserved. | document authors. All rights reserved. | |||
| This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
| Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
| (https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| skipping to change at page 2, line 27 ¶ | skipping to change at page 2, line 27 ¶ | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 | |||
| 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4 | 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4 | |||
| 2. Is HTTP Being Used? . . . . . . . . . . . . . . . . . . . . . 4 | 2. Is HTTP Being Used? . . . . . . . . . . . . . . . . . . . . . 4 | |||
| 3. What's Important About HTTP . . . . . . . . . . . . . . . . . 5 | 3. What's Important About HTTP . . . . . . . . . . . . . . . . . 5 | |||
| 3.1. Generic Semantics . . . . . . . . . . . . . . . . . . . . 5 | 3.1. Generic Semantics . . . . . . . . . . . . . . . . . . . . 5 | |||
| 3.2. Links . . . . . . . . . . . . . . . . . . . . . . . . . . 6 | 3.2. Links . . . . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 3.3. Getting Value from HTTP . . . . . . . . . . . . . . . . . 6 | 3.3. Getting Value from HTTP . . . . . . . . . . . . . . . . . 6 | |||
| 4. Best Practices for Using HTTP . . . . . . . . . . . . . . . . 7 | 4. Best Practices for Using HTTP . . . . . . . . . . . . . . . . 7 | |||
| 4.1. Specifying the Use of HTTP . . . . . . . . . . . . . . . 7 | 4.1. Specifying the Use of HTTP . . . . . . . . . . . . . . . 7 | |||
| 4.2. Defining HTTP Resources . . . . . . . . . . . . . . . . . 8 | 4.2. Defining HTTP Resources . . . . . . . . . . . . . . . . . 8 | |||
| 4.3. HTTP URLs . . . . . . . . . . . . . . . . . . . . . . . . 9 | 4.3. Specifying Client Behaviours . . . . . . . . . . . . . . 9 | |||
| 4.3.1. Initial URL Discovery . . . . . . . . . . . . . . . . 9 | 4.4. HTTP URLs . . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
| 4.3.2. URL Schemes . . . . . . . . . . . . . . . . . . . . . 10 | 4.4.1. Initial URL Discovery . . . . . . . . . . . . . . . . 10 | |||
| 4.3.3. Transport Ports . . . . . . . . . . . . . . . . . . . 11 | 4.4.2. URL Schemes . . . . . . . . . . . . . . . . . . . . . 10 | |||
| 4.4. HTTP Methods . . . . . . . . . . . . . . . . . . . . . . 11 | 4.4.3. Transport Ports . . . . . . . . . . . . . . . . . . . 12 | |||
| 4.5. HTTP Status Codes . . . . . . . . . . . . . . . . . . . . 12 | 4.5. HTTP Methods . . . . . . . . . . . . . . . . . . . . . . 12 | |||
| 4.6. HTTP Header Fields . . . . . . . . . . . . . . . . . . . 13 | 4.6. HTTP Status Codes . . . . . . . . . . . . . . . . . . . . 12 | |||
| 4.7. Defining Message Payloads . . . . . . . . . . . . . . . . 14 | 4.7. HTTP Header Fields . . . . . . . . . . . . . . . . . . . 13 | |||
| 4.8. Authentication and Application State . . . . . . . . . . 14 | 4.8. Defining Message Payloads . . . . . . . . . . . . . . . . 15 | |||
| 4.9. Co-Existing with Web Browsing . . . . . . . . . . . . . . 14 | 4.9. Authentication and Application State . . . . . . . . . . 15 | |||
| 4.10. Co-Existing with Other Applications . . . . . . . . . . . 15 | 4.10. Co-Existing with Web Browsing . . . . . . . . . . . . . . 15 | |||
| 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 | 4.11. Co-Existing with Other Applications . . . . . . . . . . . 16 | |||
| 6. Security Considerations . . . . . . . . . . . . . . . . . . . 15 | 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 | |||
| 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 | 6. Security Considerations . . . . . . . . . . . . . . . . . . . 16 | |||
| 7.1. Normative References . . . . . . . . . . . . . . . . . . 16 | 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 17 | |||
| 7.2. Informative References . . . . . . . . . . . . . . . . . 18 | 7.1. Normative References . . . . . . . . . . . . . . . . . . 17 | |||
| 7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 20 | 7.2. Informative References . . . . . . . . . . . . . . . . . 19 | |||
| Appendix A. Changes from RFC3205 . . . . . . . . . . . . . . . . 20 | 7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20 | Appendix A. Changes from RFC3205 . . . . . . . . . . . . . . . . 21 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 21 | ||||
| 1. Introduction | 1. Introduction | |||
| HTTP [RFC7230] is often used as a substrate for other application | HTTP [RFC7230] is often used as a substrate for other application | |||
| protocols. This is done for a variety of reasons, including: | protocols. This is done for a variety of reasons, including: | |||
| o familiarity by implementers, specifiers, administrators, | o familiarity by implementers, specifiers, administrators, | |||
| developers and users, | developers and users, | |||
| o availability of a variety of client, server and proxy | o availability of a variety of client, server and proxy | |||
| skipping to change at page 4, line 26 ¶ | skipping to change at page 4, line 26 ¶ | |||
| document, we say an application is _using HTTP_ when any of the | document, we say an application is _using HTTP_ when any of the | |||
| following conditions are true: | following conditions are true: | |||
| o The transport port in use is 80 or 443, | o The transport port in use is 80 or 443, | |||
| o The URL scheme "http" or "https" is used, | o The URL scheme "http" or "https" is used, | |||
| o The ALPN protocol ID [RFC7301] generically identifies HTTP (e.g., | o The ALPN protocol ID [RFC7301] generically identifies HTTP (e.g., | |||
| "http/1.1", "h2", "h2c"), or | "http/1.1", "h2", "h2c"), or | |||
| o The message formats described in [RFC7230] and/or [RFC7540] are | o The IANA registries defined for HTTP are updated or modified. | |||
| used in conjunction with the IANA registries defined for HTTP. | ||||
| When an application is using HTTP, all of the requirements of the | When an application is using HTTP, all of the requirements of the | |||
| HTTP protocol suite (including but not limited to [RFC7230], | HTTP protocol suite (including but not limited to [RFC7230], | |||
| [RFC7231], [RFC7232], [RFC7233], [RFC7234], [RFC7235] and [RFC7540]) | [RFC7231], [RFC7232], [RFC7233], [RFC7234], [RFC7235] and [RFC7540]) | |||
| are in force. | are in force. | |||
| An application might not be _using HTTP_ according to this | An application might not be _using HTTP_ according to this | |||
| definition, but still relying upon the HTTP specifications in some | definition, but still relying upon the HTTP specifications in some | |||
| manner. For example, an application might wish to avoid re- | manner. For example, an application might wish to avoid re- | |||
| specifying parts of the message format, but change others; or, it | specifying parts of the message format, but change others; or, it | |||
| skipping to change at page 6, line 43 ¶ | skipping to change at page 6, line 43 ¶ | |||
| "mix" different applications on the same server, and offers a natural | "mix" different applications on the same server, and offers a natural | |||
| path for extensibility, versioning and capability management. | path for extensibility, versioning and capability management. | |||
| 3.3. Getting Value from HTTP | 3.3. Getting Value from HTTP | |||
| The simplest possible use of HTTP is to POST data to a single URL, | The simplest possible use of HTTP is to POST data to a single URL, | |||
| thereby effectively tunnelling through the protocol. | thereby effectively tunnelling through the protocol. | |||
| This "RPC" style of communication does get some benefit from using | This "RPC" style of communication does get some benefit from using | |||
| HTTP - namely, message framing and the availability of | HTTP - namely, message framing and the availability of | |||
| implementations - but fails to realise many others: | implementations - but fails to realise many others when used | |||
| exclusively: | ||||
| o Caching for server scalability, latency and bandwidth reduction, | o Caching for server scalability, latency and bandwidth reduction, | |||
| and reliability; | and reliability; | |||
| o Authentication and access control; | o Granularity of access control (through use of a rich space of | |||
| URLs); | ||||
| o Automatic redirection; | ||||
| o Partial content to selectively request part of a response; | o Partial content to selectively request part of a response; | |||
| o Natural support for extensions and versioning through protocol | o Definition of an information space using URLs; and | |||
| extension; and | ||||
| o The ability to interact with the application easily using a Web | o The ability to interact with the application easily using a Web | |||
| browser. | browser. | |||
| Using such a high-level protocol to tunnel simple semantics has | Using such a high-level protocol to tunnel simple semantics has | |||
| downsides too; because of its more advanced capabilities, breadth of | downsides too; because of its more advanced capabilities, breadth of | |||
| deployment and age, HTTP's complexity can cause interoperability | deployment and age, HTTP's complexity can cause interoperability | |||
| problems that could be avoided by using a simpler substrate (e.g., | problems that could be avoided by using a simpler substrate (e.g., | |||
| WebSockets [RFC6455], if browser support is necessary, or TCP | WebSockets [RFC6455], if browser support is necessary, or TCP | |||
| [RFC0793] if not), or making the application be _based upon HTTP_, | [RFC0793] if not), or making the application be _based upon HTTP_, | |||
| skipping to change at page 8, line 33 ¶ | skipping to change at page 8, line 33 ¶ | |||
| [payload here] | [payload here] | |||
| 4.2. Defining HTTP Resources | 4.2. Defining HTTP Resources | |||
| HTTP Applications SHOULD focus on defining the following application- | HTTP Applications SHOULD focus on defining the following application- | |||
| specific protocol elements: | specific protocol elements: | |||
| o Media types [RFC6838], often based upon a format convention such | o Media types [RFC6838], often based upon a format convention such | |||
| as JSON [RFC7159], | as JSON [RFC7159], | |||
| o HTTP header fields, as per Section 4.6, and | o HTTP header fields, as per Section 4.7, and | |||
| o The behaviour of resources, as identified by link relations | o The behaviour of resources, as identified by link relations | |||
| [RFC5988]. | [RFC5988]. | |||
| By composing these protocol elements, an application can define a set | By composing these protocol elements, an application can define a set | |||
| of resources, identified by link relations, that implement specified | of resources, identified by link relations, that implement specified | |||
| behaviours, including: | behaviours, including: | |||
| o Retrieval of their state using GET, in one or more formats | o Retrieval of their state using GET, in one or more formats | |||
| identified by media type; | identified by media type; | |||
| skipping to change at page 9, line 20 ¶ | skipping to change at page 9, line 20 ¶ | |||
| to the same link. Widget resources can be deleted. | to the same link. Widget resources can be deleted. | |||
| The "Example-Count" response header field on Widget representations | The "Example-Count" response header field on Widget representations | |||
| indicates how many Widgets are held by the sender. | indicates how many Widgets are held by the sender. | |||
| The "application/example-widget+json" format is a JSON {{RFC7159}} | The "application/example-widget+json" format is a JSON {{RFC7159}} | |||
| format representing the state of a Widget. It contains links to | format representing the state of a Widget. It contains links to | |||
| related information in the link indicated by the Link header field | related information in the link indicated by the Link header field | |||
| value with the "example-other-info" link relation type. | value with the "example-other-info" link relation type. | |||
| 4.3. HTTP URLs | 4.3. Specifying Client Behaviours | |||
| HTTP does not mandate some behaviours that have nevertheless become | ||||
| very common; if these are not explicitly specified by applications | ||||
| using HTTP, there may be confusing or interoperability problems. | ||||
| This section lists common examples of this, and recommends default | ||||
| handling for them. | ||||
| o Redirect handling - applications using HTTP SHOULD specify that | ||||
| 3xx redirect status codes be followed automatically. See | ||||
| [RFC7231], Section 6.4. | ||||
| o Redirect methods - applications using HTTP SHOULD specify that 301 | ||||
| and 302 redirect status codes rewrite the POST method to GET. See | ||||
| [RFC7231], Section 6.4. | ||||
| o Cookies - Applications using HTTP MUST explicitly reference the | ||||
| Cookie specification [RFC6265] if they are required. | ||||
| o Certificates - Applications using HTTP MUST specify that TLS | ||||
| certificates are to be checked according to [RFC2818] when HTTPS | ||||
| is used. | ||||
| In general, applications using HTTP SHOULD align their usage as | ||||
| closely as possible with Web browsers, to avoid interoperability | ||||
| issues when they are used. See Section 4.10. | ||||
| Applications using HTTP MUST NOT require HTTP features that are | ||||
| usually negotiated to be supported. For example, requiring that | ||||
| clients support responses with a certain content-encoding ([RFC7231], | ||||
| Section 3.1.2.2) instead of negotiating for it ([RFC7231], | ||||
| Section 5.3.4) means that otherwise conformant clients cannot | ||||
| interoperate with the application. Applications MAY encourage the | ||||
| implementation of such features, though. | ||||
| 4.4. HTTP URLs | ||||
| In HTTP, URLs are opaque identifiers under the control of the server. | In HTTP, URLs are opaque identifiers under the control of the server. | |||
| As outlined in [RFC7320], standards cannot usurp this space, since it | As outlined in [RFC7320], standards cannot usurp this space, since it | |||
| might conflict with existing resources, and constrain implementation | might conflict with existing resources, and constrain implementation | |||
| and deployment. | and deployment. | |||
| In other words, applications that use HTTP MUST NOT associate | In other words, applications that use HTTP MUST NOT associate | |||
| application semantics with specific URL paths on arbitrary servers. | application semantics with specific URL paths on arbitrary servers. | |||
| Doing so inappropriately conflates the identity of the resource (its | Doing so inappropriately conflates the identity of the resource (its | |||
| URL) with the capabilities that resource supports, bringing about | URL) with the capabilities that resource supports, bringing about | |||
| skipping to change at page 9, line 44 ¶ | skipping to change at page 10, line 31 ¶ | |||
| document" is bad practice. Likewise, specifying "The widget API is | document" is bad practice. Likewise, specifying "The widget API is | |||
| at the path /bar" violates [RFC7320]. | at the path /bar" violates [RFC7320]. | |||
| Instead, applications that use HTTP are encouraged to ensure that | Instead, applications that use HTTP are encouraged to ensure that | |||
| URLs are discovered at runtime, allowing HTTP-based services to | URLs are discovered at runtime, allowing HTTP-based services to | |||
| describe their own capabilities. One way to do this is to use typed | describe their own capabilities. One way to do this is to use typed | |||
| links [RFC5988] to convey the URIs that are in use, as well as the | links [RFC5988] to convey the URIs that are in use, as well as the | |||
| semantics of the resources that they identify. See Section 4.2 for | semantics of the resources that they identify. See Section 4.2 for | |||
| details. | details. | |||
| 4.3.1. Initial URL Discovery | 4.4.1. Initial URL Discovery | |||
| Generally, a client will begin interacting with a given application | Generally, a client will begin interacting with a given application | |||
| server by requesting an initial document that contains information | server by requesting an initial document that contains information | |||
| about that particular deployment, potentially including links to | about that particular deployment, potentially including links to | |||
| other relevant resources. | other relevant resources. | |||
| Applications that use HTTP SHOULD allow an arbitrary URL to be used | Applications that use HTTP SHOULD allow an arbitrary URL to be used | |||
| as that entry point. For example, rather than specifying "the | as that entry point. For example, rather than specifying "the | |||
| initial document is at "/foo/v1", they should allow a deployment to | initial document is at "/foo/v1", they should allow a deployment to | |||
| use any URL as the entry point for the application. | use any URL as the entry point for the application. | |||
| In cases where doing so is impractical (e.g., it is not possible to | In cases where doing so is impractical (e.g., it is not possible to | |||
| convey a whole URL, but only a hostname) standard applications that | convey a whole URL, but only a hostname) standard applications that | |||
| use HTTP can request a well-known URL [RFC5785] as an entry point. | use HTTP can request a well-known URL [RFC5785] as an entry point. | |||
| 4.3.2. URL Schemes | 4.4.2. URL Schemes | |||
| Applications that use HTTP will typically use the "http" and/or | Applications that use HTTP will typically use the "http" and/or | |||
| "https" URL schemes. "https" is preferred to provide authentication, | "https" URL schemes. "https" is preferred to provide authentication, | |||
| integrity and confidentiality, as well as mitigate pervasive | integrity and confidentiality, as well as mitigate pervasive | |||
| monitoring attacks [RFC7258]. | monitoring attacks [RFC7258]. | |||
| However, application-specific schemes can be defined as well. | However, application-specific schemes can be defined as well. | |||
| When defining an URL scheme for an application using HTTP, there are | When defining an URL scheme for an application using HTTP, there are | |||
| a number of tradeoffs and caveats to keep in mind: | a number of tradeoffs and caveats to keep in mind: | |||
| skipping to change at page 11, line 4 ¶ | skipping to change at page 11, line 41 ¶ | |||
| which can present security and operability issues. For example, | which can present security and operability issues. For example, | |||
| using a new scheme to assure that requests don't get sent to a | using a new scheme to assure that requests don't get sent to a | |||
| "normal" Web site is likely to fail. | "normal" Web site is likely to fail. | |||
| o Features that rely upon the URL's origin [RFC6454], such as the | o Features that rely upon the URL's origin [RFC6454], such as the | |||
| Web's same-origin policy, will be impacted by a change of scheme. | Web's same-origin policy, will be impacted by a change of scheme. | |||
| o HTTP-specific features such as cookies [RFC6265], authentication | o HTTP-specific features such as cookies [RFC6265], authentication | |||
| [RFC7235], caching [RFC7234], and CORS [FETCH] might or might not | [RFC7235], caching [RFC7234], and CORS [FETCH] might or might not | |||
| work correctly, depending on how they are defined and implemented. | work correctly, depending on how they are defined and implemented. | |||
| Generally, they are designed and implemented with an assumption | Generally, they are designed and implemented with an assumption | |||
| that the URL will always be "http" or "https". | that the URL will always be "http" or "https". | |||
| o Web features that require a secure context | o Web features that require a secure context | |||
| [W3C.CR-secure-contexts-20160915] will likely treat a new scheme | [W3C.CR-secure-contexts-20160915] will likely treat a new scheme | |||
| as insecure. | as insecure. | |||
| See [RFC7595] for more information about minting new URL schemes. | See [RFC7595] for more information about minting new URL schemes. | |||
| 4.3.3. Transport Ports | 4.4.3. Transport Ports | |||
| Applications that use HTTP can use the applicable default port (80 | Applications that use HTTP can use the applicable default port (80 | |||
| for HTTP, 443 for HTTPS), or they can be deployed upon other ports. | for HTTP, 443 for HTTPS), or they can be deployed upon other ports. | |||
| This decision can be made at deployment time, or might be encouraged | This decision can be made at deployment time, or might be encouraged | |||
| by the application's specification (e.g., by registering a port for | by the application's specification (e.g., by registering a port for | |||
| that application). | that application). | |||
| In either case, non-default ports will need to be reflected in the | In either case, non-default ports will need to be reflected in the | |||
| authority of all URLs for that resource; the only mechanism for | authority of all URLs for that resource; the only mechanism for | |||
| changing a default port is changing the scheme (see Section 4.3.2). | changing a default port is changing the scheme (see Section 4.4.2). | |||
| Using a port other than the default has privacy implications (i.e., | Using a port other than the default has privacy implications (i.e., | |||
| the protocol can now be distinguished from other traffic), as well as | the protocol can now be distinguished from other traffic), as well as | |||
| operability concerns (as some networks might block or otherwise | operability concerns (as some networks might block or otherwise | |||
| interfere with it). Privacy implications SHOULD be documented in | interfere with it). Privacy implications SHOULD be documented in | |||
| Security Considerations. | Security Considerations. | |||
| See [RFC7605] for further guidance. | See [RFC7605] for further guidance. | |||
| 4.4. HTTP Methods | 4.5. HTTP Methods | |||
| Applications that use HTTP MUST confine themselves to using | Applications that use HTTP MUST confine themselves to using | |||
| registered HTTP methods such as GET, POST, PUT, DELETE, and PATCH. | registered HTTP methods such as GET, POST, PUT, DELETE, and PATCH. | |||
| New HTTP methods are rare; they are required to be registered with | New HTTP methods are rare; they are required to be registered with | |||
| IETF Review (see [RFC7232]), and are also required to be _generic_. | IETF Review (see [RFC7232]), and are also required to be _generic_. | |||
| That means that they need to be potentially applicable to all | That means that they need to be potentially applicable to all | |||
| resources, not just those of one application. | resources, not just those of one application. | |||
| While historically some applications (e.g., [RFC4791]) has defined | While historically some applications (e.g., [RFC4791]) have defined | |||
| non-generic methods, [RFC7231] now forbids this. | non-generic methods, [RFC7231] now forbids this. | |||
| When it is believed that a new method is required, authors are | When authors believe that a new method is required, they are | |||
| encouraged to engage with the HTTP community early, and document | encouraged to engage with the HTTP community early, and document | |||
| their proposal as a separate HTTP extension, rather than as part of | their proposal as a separate HTTP extension, rather than as part of | |||
| an application's specification. | an application's specification. | |||
| 4.5. HTTP Status Codes | 4.6. HTTP Status Codes | |||
| Applications that use HTTP MUST only use registered HTTP status | Applications that use HTTP MUST only use registered HTTP status | |||
| codes. | codes. | |||
| As with methods, new HTTP status codes are rare, and required (by | As with methods, new HTTP status codes are rare, and required (by | |||
| [RFC7231]) to be registered with IETF review. Similarly, HTTP status | [RFC7231]) to be registered with IETF review. Similarly, HTTP status | |||
| codes are generic; they are required (by [RFC7231]) to be potentially | codes are generic; they are required (by [RFC7231]) to be potentially | |||
| applicable to all resources, not just to those of one application. | applicable to all resources, not just to those of one application. | |||
| When it is believed that a new status code is required, authors are | When authors believe that a new status code is required, they are | |||
| encouraged to engage with the HTTP community early, and document | encouraged to engage with the HTTP community early, and document | |||
| their proposal as a separate HTTP extension, rather than as part of | their proposal as a separate HTTP extension, rather than as part of | |||
| an application's specification. | an application's specification. | |||
| Status codes' primary function is to convey HTTP semantics for the | The primary function of status codes is to convey HTTP semantics for | |||
| benefit of generic HTTP software, not application-specific semantics. | the benefit of generic HTTP software, not application-specific | |||
| Therefore, applications MUST NOT specify additional semantics or | semantics. Therefore, applications MUST NOT specify additional | |||
| refine existing semantics for status codes. | semantics or refine existing semantics for status codes. | |||
| In particular, specifying that a particular status code has a | In particular, specifying that a particular status code has a | |||
| specific meaning in the context of an application is harmful, as | specific meaning in the context of an application is harmful, as | |||
| these are not generic semantics, since the consumer needs to be in | these are not generic semantics, since the consumer needs to be in | |||
| the context of the application to understand them. | the context of the application to understand them. | |||
| Furthermore, applications using HTTP MUST NOT re-specify the | Furthermore, applications using HTTP MUST NOT re-specify the | |||
| semantics of HTTP status codes, even if it is only by copying their | semantics of HTTP status codes, even if it is only by copying their | |||
| definition. They MUST NOT require specific reason phrases to be | definition. They MUST NOT require specific reason phrases to be | |||
| used; the reason phrase has no function in HTTP, and is not | used; the reason phrase has no function in HTTP, and is not | |||
| skipping to change at page 13, line 7 ¶ | skipping to change at page 13, line 45 ¶ | |||
| Authentication Required" response; or, if the server is rate limiting | Authentication Required" response; or, if the server is rate limiting | |||
| the client, it might receive a "429 Too Many Requests" response. | the client, it might receive a "429 Too Many Requests" response. | |||
| Since the list of HTTP status codes can be added to, it's safer to | Since the list of HTTP status codes can be added to, it's safer to | |||
| refer to it directly, and point out that clients SHOULD be able to | refer to it directly, and point out that clients SHOULD be able to | |||
| handle all applicable protocol elements gracefully (i.e., falling | handle all applicable protocol elements gracefully (i.e., falling | |||
| back to the generic "n00" semantics of a given status code; e.g., | back to the generic "n00" semantics of a given status code; e.g., | |||
| "499" can be safely handled as "400" by clients that don't recognise | "499" can be safely handled as "400" by clients that don't recognise | |||
| it). | it). | |||
| 4.6. HTTP Header Fields | 4.7. HTTP Header Fields | |||
| Applications that use HTTP MAY define new HTTP header fields, | Applications that use HTTP MAY define new HTTP header fields, | |||
| following the advice in [RFC7231], Section 8.3.1. | following the advice in [RFC7231], Section 8.3.1. | |||
| Typically, using HTTP header fields is appropriate in a few different | Typically, using HTTP header fields is appropriate in a few different | |||
| situations: | situations: | |||
| o Their content is useful to intermediaries (who often wish to avoid | o Their content is useful to intermediaries (who often wish to avoid | |||
| parsing the body), and/or | parsing the body), and/or | |||
| skipping to change at page 13, line 48 ¶ | skipping to change at page 14, line 38 ¶ | |||
| consuming more generic header names, not to reserve a portion of the | consuming more generic header names, not to reserve a portion of the | |||
| namespace for the application; see [RFC6648] for related | namespace for the application; see [RFC6648] for related | |||
| considerations. | considerations. | |||
| The semantics of existing HTTP header fields MUST NOT be re-defined | The semantics of existing HTTP header fields MUST NOT be re-defined | |||
| without updating their registration or defining an extension to them | without updating their registration or defining an extension to them | |||
| (if allowed). For example, an application using HTTP cannot specify | (if allowed). For example, an application using HTTP cannot specify | |||
| that the "Location" header has a special meaning in a certain | that the "Location" header has a special meaning in a certain | |||
| context. | context. | |||
| See Section 4.8 for requirements regarding header fields that carry | If an application defines a request header field that might be used | |||
| by a server to change the response's headers or body, authors should | ||||
| point out that this has implications for caching; in general, such | ||||
| resources need to either make their responses uncacheable (e.g., with | ||||
| the "no-store" cache-control directive defined in [RFC7234], | ||||
| Section 5.2.2.3) or consistently send the Vary response header | ||||
| ([RFC7231], Section 7.1.4). | ||||
| See Section 4.9 for requirements regarding header fields that carry | ||||
| application state (e.g,. Cookie). | application state (e.g,. Cookie). | |||
| 4.7. Defining Message Payloads | Applications that use already-defined HTTP header fields MUST NOT | |||
| modify their semantics or syntax, unless the definition of that | ||||
| header field explicitly allows it (e.g., with an extension field). | ||||
| 4.8. Defining Message Payloads | ||||
| There are many potential formats for payloads; for example, JSON | There are many potential formats for payloads; for example, JSON | |||
| [RFC8259] and XML [W3C.REC-xml-20081126]. Best practices for their | [RFC8259], XML [W3C.REC-xml-20081126], and CBOR [RFC7049]. Best | |||
| use are out of scope for this document. | practices for their use are out of scope for this document. | |||
| Applications SHOULD register distinct media types for each format | Applications SHOULD register distinct media types for each format | |||
| they define; this makes it possible to identify them unambiguously | they define; this makes it possible to identify them unambiguously | |||
| and negotiate for their use. See [RFC6838] for more information. | and negotiate for their use. See [RFC6838] for more information. | |||
| 4.8. Authentication and Application State | 4.9. Authentication and Application State | |||
| Applications that use HTTP MAY use stateful cookies [RFC6265] to | Applications that use HTTP MAY use stateful cookies [RFC6265] to | |||
| identify a client and/or store client-specific data to contextualise | identify a client and/or store client-specific data to contextualise | |||
| requests. | requests. | |||
| If it is only necessary to identify clients, applications that use | If it is only necessary to identify clients, applications that use | |||
| HTTP MAY use HTTP authentication [RFC7235]; if either of the Basic | HTTP MAY use HTTP authentication [RFC7235]. If the Basic | |||
| [RFC7617] or Digest [RFC7616] authentication schemes is used, it MUST | authentication scheme [RFC7617] is used, it MUST NOT be used with the | |||
| NOT be used with the 'http' URL scheme. | 'http' URL scheme. If the Digest scheme [RFC7616] is used, it MUST | |||
| NOT be used with the 'http' URL scheme, unless the chosen hash | ||||
| algorithm is not "MD5". | ||||
| In either case, it is important to carefully specify the scoping and | In either case, it is important to carefully specify the scoping and | |||
| use of these mechanisms; if they expose sensitive data or | use of these mechanisms; if they expose sensitive data or | |||
| capabilities (e.g., by acting as an ambient authority), exploits are | capabilities (e.g., by acting as an ambient authority), exploits are | |||
| possible. Mitigations include using a request-specific token to | possible. Mitigations include using a request-specific token to | |||
| assure the intent of the client. | assure the intent of the client. | |||
| Applications MUST NOT make assumptions about the relationship between | Applications MUST NOT make assumptions about the relationship between | |||
| separate requests on a single transport connection; doing so breaks | separate requests on a single transport connection; doing so breaks | |||
| many of the assumptions of HTTP as a stateless protocol, and will | many of the assumptions of HTTP as a stateless protocol, and will | |||
| cause problems in interoperability, security, operability and | cause problems in interoperability, security, operability and | |||
| evolution. | evolution. | |||
| 4.9. Co-Existing with Web Browsing | 4.10. Co-Existing with Web Browsing | |||
| Even if there is not an intent for an application that uses HTTP to | Even if there is not an intent for an application that uses HTTP to | |||
| be used with a Web browser, its resources will remain available to | be used with a Web browser, its resources will remain available to | |||
| browsers and other HTTP clients. | browsers and other HTTP clients. | |||
| This means that all such applications need to consider how browsers | This means that all such applications need to consider how browsers | |||
| will interact with them, particularly regarding security. | will interact with them, particularly regarding security. | |||
| For example, if an application's state can be changed using a POST | For example, if an application's state can be changed using a POST | |||
| request, a Web browser can easily be coaxed into making that request | request, a Web browser can easily be coaxed into making that request | |||
| skipping to change at page 15, line 18 ¶ | skipping to change at page 16, line 18 ¶ | |||
| This is only a small sample of the kinds of issues that applications | This is only a small sample of the kinds of issues that applications | |||
| using HTTP must consider. Generally, the best approach is to | using HTTP must consider. Generally, the best approach is to | |||
| consider the application _as_ a Web application, and to follow best | consider the application _as_ a Web application, and to follow best | |||
| practices for their secure development. | practices for their secure development. | |||
| A complete enumeration of such practices is out of scope for this | A complete enumeration of such practices is out of scope for this | |||
| document. External resources are numerous; e.g., | document. External resources are numerous; e.g., | |||
| https://www.owasp.org/index.php/OWASP_Guide_Project [4]. | https://www.owasp.org/index.php/OWASP_Guide_Project [4]. | |||
| 4.10. Co-Existing with Other Applications | 4.11. Co-Existing with Other Applications | |||
| Because the origin [RFC6454] is how many HTTP capabilities are | Because the origin [RFC6454] is how many HTTP capabilities are | |||
| scoped, applications also need to consider how deployments might | scoped, applications also need to consider how deployments might | |||
| interact with other applications (including Web browsing) on the same | interact with other applications (including Web browsing) on the same | |||
| origin. | origin. | |||
| For example, if Cookies [RFC6265] are used to carry application | For example, if Cookies [RFC6265] are used to carry application | |||
| state, they will be sent with all requests to the origin by default, | state, they will be sent with all requests to the origin by default, | |||
| unless scoped by path, and the application might receive cookies from | unless scoped by path, and the application might receive cookies from | |||
| other applications on the origin. This can lead to security issues, | other applications on the origin. This can lead to security issues, | |||
| skipping to change at page 15, line 50 ¶ | skipping to change at page 16, line 50 ¶ | |||
| to access resources from another, to avoid the "confused deputy" | to access resources from another, to avoid the "confused deputy" | |||
| problem. As a result, applications that wish to expose cross-origin | problem. As a result, applications that wish to expose cross-origin | |||
| data to browsers will need to implement [W3C.REC-cors-20140116]. | data to browsers will need to implement [W3C.REC-cors-20140116]. | |||
| 5. IANA Considerations | 5. IANA Considerations | |||
| This document has no requirements for IANA. | This document has no requirements for IANA. | |||
| 6. Security Considerations | 6. Security Considerations | |||
| Section 4.8 discusses the impact of using stateful mechanisms in the | Section 4.9 discusses the impact of using stateful mechanisms in the | |||
| protocol as ambient authority, and suggests a mitigation. | protocol as ambient authority, and suggests a mitigation. | |||
| Section 4.3.2 requires support for 'https' URLs, and discourages the | Section 4.4.2 requires support for 'https' URLs, and discourages the | |||
| use of 'http' URLs, to provide authentication, integrity and | use of 'http' URLs, to provide authentication, integrity and | |||
| confidentiality, as well as mitigate pervasive monitoring attacks. | confidentiality, as well as mitigate pervasive monitoring attacks. | |||
| Section 4.9 highlights the implications of Web browsers' capabilities | Section 4.10 highlights the implications of Web browsers' | |||
| on applications that use HTTP. | capabilities on applications that use HTTP. | |||
| Section 4.11 discusses the issues that arise when applications are | ||||
| deployed on the same origin as Web sites (and other applications). | ||||
| Applications that use HTTP in a manner that involves modification of | Applications that use HTTP in a manner that involves modification of | |||
| implementations - for example, requiring support for a new URL | implementations - for example, requiring support for a new URL | |||
| scheme, or a non-standard method - risk having those implementations | scheme, or a non-standard method - risk having those implementations | |||
| "fork" from their parent HTTP implementations, with the possible | "fork" from their parent HTTP implementations, with the possible | |||
| result that they do not benefit from patches and other security | result that they do not benefit from patches and other security | |||
| improvements incorporated upstream. | improvements incorporated upstream. | |||
| 7. References | 7. References | |||
| 7.1. Normative References | 7.1. Normative References | |||
| [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | |||
| Requirement Levels", BCP 14, RFC 2119, | Requirement Levels", BCP 14, RFC 2119, | |||
| DOI 10.17487/RFC2119, March 1997, | DOI 10.17487/RFC2119, March 1997, | |||
| <https://www.rfc-editor.org/info/rfc2119>. | <https://www.rfc-editor.org/info/rfc2119>. | |||
| [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, | ||||
| DOI 10.17487/RFC2818, May 2000, | ||||
| <https://www.rfc-editor.org/info/rfc2818>. | ||||
| [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration | [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration | |||
| Procedures for Message Header Fields", BCP 90, RFC 3864, | Procedures for Message Header Fields", BCP 90, RFC 3864, | |||
| DOI 10.17487/RFC3864, September 2004, | DOI 10.17487/RFC3864, September 2004, | |||
| <https://www.rfc-editor.org/info/rfc3864>. | <https://www.rfc-editor.org/info/rfc3864>. | |||
| [RFC5988] Nottingham, M., "Web Linking", RFC 5988, | [RFC5988] Nottingham, M., "Web Linking", RFC 5988, | |||
| DOI 10.17487/RFC5988, October 2010, | DOI 10.17487/RFC5988, October 2010, | |||
| <https://www.rfc-editor.org/info/rfc5988>. | <https://www.rfc-editor.org/info/rfc5988>. | |||
| [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, | [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, | |||
| skipping to change at page 19, line 9 ¶ | skipping to change at page 20, line 13 ¶ | |||
| <https://www.rfc-editor.org/info/rfc5785>. | <https://www.rfc-editor.org/info/rfc5785>. | |||
| [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, | [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, | |||
| DOI 10.17487/RFC6265, April 2011, | DOI 10.17487/RFC6265, April 2011, | |||
| <https://www.rfc-editor.org/info/rfc6265>. | <https://www.rfc-editor.org/info/rfc6265>. | |||
| [RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", | [RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", | |||
| RFC 6455, DOI 10.17487/RFC6455, December 2011, | RFC 6455, DOI 10.17487/RFC6455, December 2011, | |||
| <https://www.rfc-editor.org/info/rfc6455>. | <https://www.rfc-editor.org/info/rfc6455>. | |||
| [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object | ||||
| Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, | ||||
| October 2013, <https://www.rfc-editor.org/info/rfc7049>. | ||||
| [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data | [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data | |||
| Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | |||
| 2014, <https://www.rfc-editor.org/info/rfc7159>. | 2014, <https://www.rfc-editor.org/info/rfc7159>. | |||
| [RFC7258] Farrell, S. and H. Tschofenig, "Pervasive Monitoring Is an | [RFC7258] Farrell, S. and H. Tschofenig, "Pervasive Monitoring Is an | |||
| Attack", BCP 188, RFC 7258, DOI 10.17487/RFC7258, May | Attack", BCP 188, RFC 7258, DOI 10.17487/RFC7258, May | |||
| 2014, <https://www.rfc-editor.org/info/rfc7258>. | 2014, <https://www.rfc-editor.org/info/rfc7258>. | |||
| [RFC7595] Thaler, D., Ed., Hansen, T., and T. Hardie, "Guidelines | [RFC7595] Thaler, D., Ed., Hansen, T., and T. Hardie, "Guidelines | |||
| and Registration Procedures for URI Schemes", BCP 35, | and Registration Procedures for URI Schemes", BCP 35, | |||
| End of changes. 35 change blocks. | ||||
| 62 lines changed or deleted | 120 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||