forked from httpwg/http-extensions
/
draft-ietf-httpbis-alt-svc.xml
executable file
·1292 lines (1220 loc) · 50.6 KB
/
draft-ietf-httpbis-alt-svc.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="lib/rfc2629.xslt"?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>
<!DOCTYPE rfc [
<!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
<!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
<!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
<!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
<!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
<!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
<!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
<!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
<!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
<!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
<!ENTITY mdash "—">
]>
<rfc ipr="trust200902"
category="std"
docName="draft-ietf-httpbis-alt-svc-latest"
x:maturity-level="proposed"
xmlns:x="http://purl.org/net/xml2rfc/ext">
<x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:"/>
<front>
<title>HTTP Alternative Services</title>
<author initials="M." surname="Nottingham" fullname="Mark Nottingham">
<organization>Akamai</organization>
<address>
<email>mnot@mnot.net</email>
<uri>https://www.mnot.net/</uri>
</address>
</author>
<author initials="P." surname="McManus" fullname="Patrick McManus">
<organization>Mozilla</organization>
<address>
<email>mcmanus@ducksong.com</email>
<uri>https://mozillians.org/u/pmcmanus/</uri>
</address>
</author>
<author initials="J. F." surname="Reschke" fullname="Julian F. Reschke">
<organization abbrev="greenbytes">greenbytes GmbH</organization>
<address>
<email>julian.reschke@greenbytes.de</email>
<uri>https://greenbytes.de/tech/webdav/</uri>
</address>
</author>
<date year="2015"/>
<area>Applications and Real-Time</area>
<workgroup>HTTP</workgroup>
<keyword>HTTP</keyword>
<keyword>ALPN</keyword>
<keyword>Alternative Services</keyword>
<abstract>
<t>
This document specifies "alternative services" for HTTP, which allow an
origin's resources to be authoritatively available at a separate network
location, possibly accessed with a different protocol configuration.</t>
</abstract>
<note title="Editorial Note (To be removed by RFC Editor)">
<t>
Discussion of this draft takes place on the HTTPBIS working group mailing list
(ietf-http-wg@w3.org), which is archived at <eref
target="https://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
</t>
<t>
Working Group information can be found at <eref
target="https://tools.ietf.org/wg/httpbis/"/>
and <eref target="http://httpwg.github.io/"/>; source code and issues
list for this draft can be found at
<eref target="https://github.com/httpwg/http-extensions"/>.
</t>
<t>
The changes in this draft are summarized in <xref
target="change.log"/>.
</t>
</note>
</front>
<middle>
<section anchor="introduction" title="Introduction">
<t>
HTTP <xref target="RFC7230"/> conflates the identification of
resources with their location. In other words, "http://" (and "https://") URLs are
used to both name and find things to interact with.
</t>
<t>
In some cases, it is desirable to separate identification and location in HTTP; keeping the same
identifier for a resource, but interacting with it at a different location on the network.
</t>
<t>For example:
<list style="symbols">
<t>
An origin server might wish to redirect a client to a different server
when it is under load, or it has found a server in a location that is
more local to the client.
</t>
<t>
An origin server might wish to offer access to its resources using a new
protocol (such as HTTP/2, see <xref target="RFC7540"/>) or one using improved
security (such as Transport Layer Security (TLS), see <xref target="RFC5246"/>).
</t>
<t>
An origin server might wish to segment its clients into groups of
capabilities, such as those supporting Server Name Indication (SNI,
see <xref target="RFC6066" x:sec="3" x:fmt="of"/>) and those not
supporting it, for operational purposes.
</t>
</list>
</t>
<t>
This specification defines a new concept in HTTP, "Alternative Services",
that allows an origin server to nominate additional means of interacting with it on
the network. It defines a general framework for this in <xref
target="alternative"/>, along with specific mechanisms for advertising their
existence using HTTP header fields (<xref target="alt-svc"/>) or HTTP/2
frames (<xref target="frame"/>), plus a way to indicate that an alternative
service was used (<xref target="indicator"/>).
</t>
<t>
It also endorses the status code 421 (Misdirected Request) (<xref target="status"/>)
that origin servers (or their nominated alternatives) can use to indicate that they
are not authoritative for a given origin, in cases where the wrong location is used.
</t>
<section title="Notational Conventions" anchor="notational-conventions">
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in <xref target="RFC2119"/>.
</t>
<t anchor="imported.abnf">
<x:anchor-alias value="DIGIT"/>
<x:anchor-alias value="OWS"/>
<x:anchor-alias value="delta-seconds"/>
<x:anchor-alias value="port"/>
<x:anchor-alias value="quoted-string"/>
<x:anchor-alias value="token"/>
<x:anchor-alias value="uri-host"/>
This document uses the Augmented BNF defined in <xref target="RFC5234"/>
along with the "#rule" extension defined in <xref target="RFC7230" x:rel="#abnf.extension" x:fmt="of"/>.
The rules below are defined in <xref target="RFC5234"/>, <xref target="RFC7230"/>, and <xref target="RFC7234"/>:
</t>
<figure><artwork type="abnf2616">
DIGIT = <DIGIT, see <xref target="RFC5234" x:sec="B.1"/>>
OWS = <OWS, see <xref target="RFC7230" x:rel="#whitespace"/>>
delta-seconds = <delta-seconds; see <xref target="RFC7234" x:rel="#delta-seconds"/>>
port = <port, see <xref target="RFC7230" x:rel="#uri"/>>
quoted-string = <quoted-string, see <xref target="RFC7230" x:rel="#field.components"/>>
token = <token, see <xref target="RFC7230" x:rel="#field.components"/>>
uri-host = <uri-host, see <xref target="RFC7230" x:rel="#uri"/>>
</artwork></figure>
</section>
</section>
<section title="Alternative Services Concepts" anchor="alternative">
<t>
This specification defines a new concept in HTTP, the "<x:dfn>alternative service</x:dfn>".
When an origin (see <xref target="RFC6454"/>) has resources that are accessible through a
different protocol / host / port combination, it is said to have an alternative
service available.
</t>
<t>
An alternative service can be used to interact with the resources on an origin
server at a separate location on the network, possibly using a different
protocol configuration. Alternative services are considered authoritative for
an origin's resources, in the sense of <xref target="RFC7230" x:rel="#establishing.authority" x:fmt=","/>.
</t>
<figure>
<preamble>For example, an origin:</preamble>
<artwork type="example">
("http", "www.example.com", "80")
</artwork>
</figure>
<figure>
<preamble>might declare that its resources are also accessible at the alternative service:</preamble>
<artwork type="example">
("h2", "new.example.com", "81")
</artwork>
</figure>
<t>
By their nature, alternative services are explicitly at the granularity of an
origin; i.e., they cannot be selectively applied to resources within an origin.
</t>
<t>
Alternative services do not replace or change the origin for any given resource;
in general, they are not visible to the software "above" the access mechanism.
The alternative service is essentially alternative routing information that can
also be used to reach the origin in the same way that DNS CNAME or SRV records
define routing information at the name resolution level. Each origin maps to a
set of these routes — the default route is derived from thr origin itself and the
other routes are introduced based on alternative-protocol information.
</t>
<t>
Furthermore, it is important to note that the first member of an alternative
service tuple is different from the "scheme" component of an origin; it is more
specific, identifying not only the major version of the protocol being used,
but potentially communication options for that protocol.
</t>
<t>
This means that clients using an alternative service can change the host, port
and protocol that they are using to fetch resources, but these changes &MUST-NOT;
be propagated to the application that is using HTTP; from that standpoint, the
URI being accessed and all information derived from it (scheme, host, port) are
the same as before.
</t>
<t>
Importantly, this includes its security context; in particular, when TLS
<xref target="RFC5246"/> is used to authenticate, the alternative service will need to present a certificate
for the origin's host name, not that of the alternative. Likewise, the Host
header field (<xref target="RFC7230" x:fmt="," x:rel="#header.host"/>) is
still derived from the origin, not the alternative service (just as it would
if a CNAME were being used).
</t>
<t>
The changes &MAY;, however, be made visible in debugging tools, consoles, etc.
</t>
<t>
Formally, an alternative service is identified by the combination of:
<list style="symbols">
<t>An Application Layer Protocol Negotiation (ALPN) protocol name, as per
<xref target="RFC7301"/></t>
<t>A host, as per <xref target="RFC3986" x:fmt="," x:sec="3.2.2"/></t>
<t>A port, as per <xref target="RFC3986" x:fmt="," x:sec="3.2.3"/></t>
</list>
</t>
<t>
The ALPN protocol name is used to identify the application protocol or
suite of protocols used by the alternative service. Note that for the
purpose of this specification, an ALPN protocol name implicitly
includes TLS in the suite of protocols it identifies, unless specified
otherwise in its definition. In particular, the ALPN name "http/1.1",
registered by <xref x:sec="6" x:fmt="of" target="RFC7301"/>, identifies
HTTP/1.1 over TLS.
</t>
<t>
Additionally, each alternative service &MUST; have:
<list style="symbols">
<t>A freshness lifetime, expressed in seconds; see <xref target="caching"/></t>
</list>
</t>
<t>
There are many ways that a client could discover the alternative service(s)
associated with an origin. This document describes two such mechanisms:
an HTTP header field (<xref target="alt-svc"/>) and an HTTP/2 frame type
(<xref target="frame"/>).
</t>
<t>
The remainder of this section describes requirements that are common to alternative
services, regardless of how they are discovered.
</t>
<section title="Host Authentication" anchor="host_auth">
<t>
Clients &MUST-NOT; use alternative services with a host that is different than the origin's
without strong server authentication; this mitigates the attack described in
<xref target="host_security"/>. One way to achieve this is for the alternative to use TLS
with a certificate that is valid for that origin.
</t>
<t>
For example, if the origin's host is "www.example.com" and an alternative is
offered on "other.example.com" with the "h2" protocol, and the certificate
offered is valid for "www.example.com", the client can use the alternative.
However, if "other.example.com" is offered with the "h2c" protocol, the client
cannot use it, because there is no mechanism in that protocol to establish
strong server authentication.
</t>
</section>
<section title="Alternative Service Caching" anchor="caching">
<t>
Mechanisms for discovering alternative services also associate a freshness
lifetime with them; for example, the Alt-Svc header field uses the "ma"
parameter.
</t>
<t>
Clients &MAY; choose to use an alternative service instead of the origin at any
time when it is considered fresh; see <xref target="switching"/> for specific
recommendations.
</t>
<t>
Clients with existing connections to an alternative service do not need to
stop using it when its freshness lifetime ends; i.e., the caching
mechanism is intended for limiting how long an alternative service can be used
for establishing new connections, not limiting the use of existing ones.
</t>
<t>
When alternative services are used to send a client to the most optimal server, a change in
network configuration can result in cached values becoming suboptimal. Therefore, clients &SHOULD;
remove from cache all alternative services that lack the "persist" flag with the value "1" when
they detect such a change (when information about network state is available).
</t>
</section>
<section title="Requiring Server Name Indication" anchor="requiring-server-name-indication">
<t>
A client &MUST; only use a TLS-based alternative service if the client also
supports TLS Server Name Indication (SNI). This supports the conservation of
IP addresses on the alternative service host.
</t>
<t>
Note that the SNI information provided in TLS by the client will be that of the origin, not the
alternative (as will the Host HTTP header field-value).
</t>
</section>
<section title="Using Alternative Services" anchor="switching">
<t>
By their nature, alternative services are &OPTIONAL;: clients do not need to
use them. However, it is advantageous for clients to behave in a predictable
way when they are used by servers (e.g., for load balancing).
</t>
<t>
Therefore, if a client becomes aware of an alternative service, the client
&SHOULD; use that alternative service for all requests to the associated origin
as soon as it is available, provided that the security properties of the
alternative service protocol are desirable, as compared to the existing
connection.
</t>
<t>
If a client becomes aware of multiple alternative services, it &MAY; choose
the most suitable according to its own criteria (again, keeping security
properties in mind). For example, an origin might advertise multiple
alternative services to notify clients of support for multiple versions of
HTTP; or, an alternative service might itself advertise an alternative.
</t>
<t>
A client configured to use a proxy for a given request &SHOULD-NOT;
directly connect to an alternative service for it, but instead route it
through that proxy.
</t>
<t>
When a client uses an alternative service for a request, it can indicate
this to the server using the Alt-Used header field (<xref
target="indicator"/>).
</t>
<t>
The client does not need to block requests on any existing connection; it can be
used until the alternative connection is established. However, if the security
properties of the existing connection are weak (e.g. cleartext HTTP/1.1) then
it might make sense to block until the new connection is fully available in
order to avoid information leakage.
</t>
<t>
Furthermore, if the connection to the alternative service fails or is unresponsive, the client
&MAY; fall back to using the origin or another alternative service. Note, however, that this
could be the basis of a downgrade attack, thus losing any enhanced security properties of the
alternative service.
</t>
</section>
</section>
<section title="The Alt-Svc HTTP Header Field" anchor="alt-svc">
<t>
An HTTP(S) origin server can advertise the availability of alternative services
to clients by adding an Alt-Svc header field to responses.
</t>
<figure>
<artwork type="abnf2616">
Alt-Svc = clear / 1#alt-value
clear = <x:abnf-char-sequence>"clear"</x:abnf-char-sequence>; "clear", case-sensitive
alt-value = alternative *( OWS ";" OWS parameter )
alternative = protocol-id "=" alt-authority
protocol-id = <x:ref>token</x:ref> ; percent-encoded ALPN protocol name
alt-authority = <x:ref>quoted-string</x:ref> ; containing [ <x:ref>uri-host</x:ref> ] ":" <x:ref>port</x:ref>
parameter = <x:ref>token</x:ref> "=" ( <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref> )
</artwork>
</figure>
<t>
The field value consists either of a list of values, each of which indicating one
alternative service, or the keyword "clear".
</t>
<t>
A field value containing the special value "clear" indicates that the
origin requests all alternatives for that origin to be invalidated (including
those specified in the same response, in case of an invalid reply containing
both "clear" and alternative services).
</t>
<t>
ALPN protocol names are octet sequences with no
additional constraints on format.<!-- besides length?-->
Octets not allowed in tokens (<xref target="RFC7230" x:fmt="," x:rel="#field.components"/>)
&MUST; be percent-encoded as per <xref target="RFC3986" x:fmt="of" x:sec="2.1"/>.
Consequently, the octet representing the percent character "%" (hex 25) &MUST;
be percent-encoded as well.
</t>
<t>
In order to have precisely one way to represent any ALPN protocol name, the following
additional constraints apply:
<list style="numbers">
<t>
Octets in the ALPN protocol name &MUST-NOT; be percent-encoded if they are valid
token characters except "%", and
</t>
<t>
When using percent-encoding, uppercase hex digits &MUST; be used.
</t>
</list>
</t>
<t>
With these constraints, recipients can apply simple string comparison to
match protocol identifiers.
</t>
<t>
The "alt-authority" component consists of an &OPTIONAL; uri-host
("host" in <xref target="RFC3986" x:fmt="of" x:sec="3.2.2"/>), a colon (":"),
and a port number.
</t>
<figure>
<preamble>For example:</preamble>
<artwork type="example">
Alt-Svc: h2=":8000"
</artwork>
<postamble>
This indicates the "h2" protocol (<xref target="RFC7540"/>) on the same
host using the indicated port 8000.
</postamble>
</figure>
<figure>
<preamble>An example involving a change of host:</preamble>
<artwork type="example">
Alt-Svc: h2="new.example.org:80"
</artwork>
<postamble>
This indicates the "h2" protocol on the host "new.example.org", running
on port 80. Note that the "quoted-string" syntax needs to be used because
":" is not an allowed character in "token".
</postamble>
</figure>
<texttable style="all" align="left">
<preamble>Examples for protocol name escaping:</preamble>
<ttcol>ALPN protocol name</ttcol>
<ttcol>protocol-id</ttcol>
<ttcol>Note</ttcol>
<c>h2</c>
<c>h2</c>
<c>No escaping needed</c>
<c>w=x:y#z</c>
<c>w%3Dx%3Ay#z</c>
<c>"=" and ":" escaped</c>
<c>x%y</c>
<c>x%25y</c>
<c>"%" needs escaping</c>
</texttable>
<t>
Alt-Svc &MAY; occur in any HTTP response message, regardless of the status code.
Note that recipients of Alt-Svc are free to ignore the header field (and indeed
need to in some situations; see Sections <xref format="counter" target="host_auth"/> and <xref format="counter" target="status"/>).
</t>
<figure>
<preamble>The Alt-Svc field value can have multiple values:</preamble>
<artwork type="example">
Alt-Svc: h2c=":8000", h2=":443"
</artwork>
</figure>
<t>
When multiple values are present, the order of the values reflects the server's
preference (with the first value being the most preferred alternative).
</t>
<t>
The value(s) advertised by Alt-Svc can be used by clients to open a new
connection to an alternative service. Subsequent requests can start using this new connection
immediately, or can continue using the existing connection while the new connection is created.
</t>
<t>
When using HTTP/2 (<xref target="RFC7540"/>), servers &SHOULD; instead send an ALTSVC frame
(<xref target="frame"/>). A single ALTSVC frame can be sent for a connection;
a new frame is not needed for every request. Note that, despite this
recommendation, Alt-Svc header fields remain valid in responses delivered over HTTP/2.
</t>
<t>
This specification defines two parameters: "ma" and "persist", defined in
<xref target="caching-alt-svc-header-field-values"/>. Unknown parameters
&MUST; be ignored, that is the values (alt-value) they appear in &MUST;
be processed as if the unknown parameter was not present.
</t>
<t>
New parameters can be defined in extension specifications (see
<xref target="iana.parameters"/> for registration details).
</t>
<t>
Note that all field elements that allow "quoted-string" syntax &MUST; be processed
as per <xref target="RFC7230" x:fmt="of" x:rel="#field.components"/>.
</t>
<section title="Caching Alt-Svc Header Field Values" anchor="caching-alt-svc-header-field-values">
<t>
When an alternative service is advertised using Alt-Svc, it is considered fresh
for 24 hours from generation of the message. This can be modified with the 'ma'
(max-age) parameter:
</t>
<figure>
<artwork type="example">
Alt-Svc: h2=":443"; ma=3600
</artwork>
</figure>
<t>
which indicates the number of seconds since the response was generated the
alternative service is considered fresh for.
</t>
<figure>
<artwork type="abnf2616">
ma = <x:ref>delta-seconds</x:ref>
</artwork></figure>
<t>
See <xref target="RFC7234" x:rel="#age.calculations" x:fmt="of"/> for details of determining
response age.
</t>
<figure>
<preamble>For example, a response:</preamble>
<artwork type="message/http; msgtype="response"" x:indent-with=" ">
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: 600
Age: 30
Alt-Svc: h2c=":8000"; ma=60
</artwork>
<postamble>
indicates that an alternative service is available and usable for the next 60
seconds. However, the response has already been cached for 30 seconds (as per
the Age header field value), so therefore the alternative service is only fresh
for the 30 seconds from when this response was received, minus estimated
transit time.
</postamble>
</figure>
<t>
Note that the freshness lifetime for HTTP caching (here, 600 seconds) does not
affect caching of Alt-Svc values.
</t>
<t>
When an Alt-Svc response header field is received from an origin, its value
invalidates and replaces all cached alternative services for that origin.
</t>
<t>
By default, cached alternative services will be cleared when the client detects a network
change. Alternative services that are intended to be longer-lived (e.g., those that are not
specific to the client access network) can carry the "persist" parameter with a value "1" as a
hint that the service is potentially useful beyond a network configuration change.
</t><figure>
<artwork type="abnf2616">
persist = 1<x:ref>DIGIT</x:ref>
</artwork></figure>
<t>
For example:
</t>
<figure>
<artwork type="example">
Alt-Svc: h2=":443"; ma=2592000; persist=1
</artwork>
</figure>
<t>
This specification only a defines a single value for "persist"; others
can be defined in future specifications. Clients &MUST; ignore "persist"
parameters with unknown values.
</t>
<t>
See <xref target="caching"/> for general requirements on caching alternative services.
</t>
</section>
</section>
<section anchor="frame" title="The ALTSVC HTTP/2 Frame">
<t>
The ALTSVC HTTP/2 frame (<xref target="RFC7540" x:fmt="," x:rel="#FramingLayer"/>)
advertises the availability of an alternative service to an HTTP/2 client.
</t>
<t>
The ALTSVC frame is a non-critical extension to HTTP/2. Endpoints that do
not support this frame can safely ignore it.
</t>
<t>
An ALTSVC frame from a server to a client on a stream other than stream 0
indicates that the conveyed alternative service is associated with the origin
of that stream.
</t>
<t>
An ALTSVC frame from a server to a client on stream 0 indicates that the conveyed alternative
service is associated with the origin contained in the Origin field of the frame. An association
with an origin that the client does not consider authoritative for the current connection &MUST;
be ignored.
</t>
<t>
The ALTSVC frame type is 0xa (decimal 10).
</t>
<figure title="ALTSVC Frame Payload">
<artwork type="drawing"><![CDATA[
+-------------------------------+-------------------------------+
| Origin-Len (16) | Origin? (*) ...
+-------------------------------+-------------------------------+
| Alt-Svc-Field-Value (*) ...
+---------------------------------------------------------------+
]]></artwork>
</figure>
<t>
The ALTSVC frame contains the following fields:
<list style="hanging">
<t hangText="Origin-Len:">
An unsigned, 16-bit integer indicating the length, in octets, of the Origin field.
</t>
<t hangText="Origin:">
An &OPTIONAL; sequence of characters containing the ASCII serialization of an
origin (<xref target="RFC6454" x:fmt="," x:sec="6.2"/>) that the alternative
service is applicable to.
</t>
<t hangText="Alt-Svc-Field-Value:">
A sequence of octets (length determined by subtracting the length of all preceding fields
from the frame length) containing a value identical to the Alt-Svc field value defined in
<xref target="alt-svc"/> (ABNF production "Alt-Svc").
</t>
</list>
</t>
<t>
The ALTSVC frame does not define any flags.
</t>
<t>
The ALTSVC frame is intended for receipt by clients; a server that receives an
ALTSVC frame can safely ignore it.
</t>
<t>
An ALTSVC frame on stream 0 with empty (length 0) "Origin" information is
invalid and &MUST; be ignored. An ALTSVC frame on a stream other than stream
0 containing non-empty "Origin" information is invalid and &MUST; be ignored.
</t>
<t>
The ALTSVC frame is processed hop-by-hop. An intermediary &MUST-NOT; forward ALTSVC frames,
though it can use the information contained in ALTSVC frames in forming new ALTSVC frames
to send to its own clients.
</t>
</section>
<section title="The Alt-Used HTTP Header Field" anchor="indicator">
<t>
The Alt-Used header field is used in requests to indicate the identity of
the alternative service in use, just as the Host header field (<xref target="RFC7230" x:rel="#header.host"/>)
identifies the host and port of the origin.
</t>
<figure>
<artwork type="abnf2616">
Alt-Used = uri-host [ ":" port ]
</artwork>
</figure>
<t>
Alt-Used is intended to allow alternative services to detect loops, differentiate
traffic for purposes of load balancing, and generally to ensure that it is
possible to identify the intended destination of traffic, since introducing
this information after a protocol is in use has proven to be problematic.
</t>
<t>
When using an alternative service, clients &SHOULD; include a Alt-Used
header field in all requests.
</t>
<t>
As the Alt-Used header field might be used by the server for tracking the
client, a client &MAY; choose not to include it in its requests for
protecting its privacy (see <xref target="tracking"/>).
</t>
<figure>
<preamble>For example:</preamble>
<artwork type="message/http; msgtype="request"" x:indent-with=" ">
GET /thing HTTP/1.1
Host: origin.example.com
Alt-Used: alternate.example.net
</artwork>
</figure>
<t>
The extension parameters (ext-param) are reserved for future use;
specifications that want to define an extension will need to update this
document (and ought to introduce an extension registry).
</t>
</section>
<section title="The 421 Misdirected Request HTTP Status Code" anchor="status">
<t>
The 421 (Misdirected Request) status code is defined in <xref target="RFC7540"
x:fmt="of" x:rel="#MisdirectedRequest"/> to indicate that the current server
instance is not authoritative for the requested resource. This can be used
to indicate that an alternative service is not authoritative; see <xref
target="alternative"/>).
</t>
<t>
Clients receiving 421 (Misdirected Request) from an alternative service &MUST;
remove the corresponding entry from its alternative service cache (see <xref
target="caching"/>) for that origin. Regardless of the idempotency of the
request method, they &MAY; retry the request, either at another alternative
server, or at the origin.
</t>
<t>
An Alt-Svc header field in a 421 (Misdirected Request) response &MUST; be ignored.
</t>
</section>
<section title="IANA Considerations" anchor="iana-considerations">
<section title="Header Field Registrations">
<t>
HTTP header fields are registered within the "Message Headers" registry
maintained at
<eref target="https://www.iana.org/assignments/message-headers/"/>.
</t>
<t>
This document defines the following HTTP header fields, so their associated
registry entries shall be added according to the permanent registrations below
(see <xref target="BCP90"/>):
</t>
<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
<ttcol>Header Field Name</ttcol>
<ttcol>Protocol</ttcol>
<ttcol>Status</ttcol>
<ttcol>Reference</ttcol>
<c>Alt-Svc</c>
<c>http</c>
<c>standard</c>
<c>
<xref target="alt-svc"/>
</c>
<c>Alt-Used</c>
<c>http</c>
<c>standard</c>
<c>
<xref target="indicator"/>
</c>
</texttable>
<t>
The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
</t>
</section>
<section anchor="alt-svc-frame-registration" title="The ALTSVC HTTP/2 Frame Type">
<t>
This document registers the ALTSVC frame type in the HTTP/2 Frame Types
registry (<xref target="RFC7540" x:fmt="," x:rel="#iana-frames"/>).
<list style="empty">
<t>Frame Type: ALTSVC</t>
<t>Code: 0xa</t>
<t>Specification: <xref target="frame"/> of this document</t>
</list>
</t>
</section>
<section anchor="iana.parameters" title="Alt-Svc Parameter Registry">
<t>
The HTTP Alt-Svc Parameter Registry defines the name space for the
cache directives. It will be created and maintained at (the suggested URI)
<eref target="http://www.iana.org/assignments/http-alt-svc-parameters"/>.
</t>
<section title="Procedure" anchor="parameter.registry.procedure">
<t>
A registration &MUST; include the following fields:
<list style="symbols">
<t>Parameter Name</t>
<t>Pointer to specification text</t>
</list>
</t>
<t>
Values to be added to this name space require IETF Review (see <xref
target="RFC5226" x:fmt="," x:sec="4.1"/>).
</t>
</section>
<section title="Registrations" anchor="parameter.registrations">
<t>
The HTTP Alt-Svc Parameter Registry is to be populated with the registrations below:
</t>
<texttable align="left" suppress-title="true">
<ttcol>Alt-Svc Parameter</ttcol>
<ttcol>Reference</ttcol>
<c>ma</c>
<c>
<xref target="caching-alt-svc-header-field-values"/>
</c>
<c>persist</c>
<c>
<xref target="caching-alt-svc-header-field-values"/>
</c>
</texttable>
</section>
</section>
</section>
<section title="Internationalization Considerations" anchor="internationalization-considerations">
<t>
An internationalized domain name that appears in either the header field
(<xref target="alt-svc"/>) or the HTTP/2 frame (<xref target="frame"/>)
&MUST; be expressed using A-labels (<xref target="RFC5890" x:fmt="," x:sec="2.3.2.1"/>).
</t>
</section>
<section title="Security Considerations" anchor="security-considerations">
<section title="Changing Ports" anchor="changing-ports">
<t>
Using an alternative service implies accessing an origin's resources on an
alternative port, at a minimum. An attacker that can inject alternative services
and listen at the advertised port is therefore able to hijack an origin. On
certain servers, it is normal for users to be able to control some personal
pages available on a shared port, and also to accept to requests on less-privileged
ports.
</t>
<t>
For example, an attacker that can add HTTP response header fields to some pages
can redirect traffic for an entire origin to a different port on the same host
using the Alt-Svc header field; if that port is under the attacker's control,
they can thus masquerade as the HTTP server.
</t>
<t>
On servers, this risk can be reducted by restricting the ability to advertise
alternative services, and restricting who can open a port for listening on that host.
Clients can reduce this risk by imposing stronger requirements (e.g. strong
authentication) when moving from System Ports to User or Dynamic Ports, or from
User Ports to Dynamic Ports, as defined in <xref target="RFC6335" x:rel="#section-6"/>.
</t>
<t>
It is always valid for a client to ignore an alternative service advertisement which
does not meet its implementation-specific security requirements. Servers can increase
the likelihood of clients using the alternative service by providing strong
authentication even when not required.
</t>
</section>
<section title="Changing Hosts" anchor="host_security">
<t>
When the host is changed due to the use of an alternative service, it presents
an opportunity for attackers to hijack communication to an origin.
</t>
<t>
For example, if an attacker can convince a user agent to send all traffic for
"innocent.example.org" to "evil.example.com" by successfully associating it as an alternative
service, they can masquerade as that origin. This can be done locally (see mitigations in <xref
target="changing-ports"/>) or remotely (e.g., by an intermediary as a man-in-the-middle attack).
</t>
<t>
This is the reason for the requirement in <xref target="host_auth"/> that any alternative
service with a host different to the origin's be strongly authenticated with
the origin's identity; i.e., presenting a certificate for the origin proves
that the alternative service is authorized to serve traffic for the origin.
</t>
<t>
However, this authorization is only as strong as the method used to
authenticate the alternative service. In particular, there are well-known
exploits to make an attacker's certificate appear as legitimate.
</t>
<t>
Alternative services could be used to persist such an attack; for example, an
intermediary could man-in-the-middle TLS-protected communication to a target,
and then direct all traffic to an alternative service with a large freshness
lifetime, so that the user agent still directs traffic to the attacker even when
not using the intermediary.
</t>
</section>
<section title="Changing Protocols" anchor="changing-protocols">
<t>
When the ALPN protocol is changed due to the use of an alternative service, the
security properties of the new connection to the origin can be different from
that of the "normal" connection to the origin, because the protocol identifier
itself implies this.
</t>
<t>
For example, if a "https://" URI has a protocol advertised that does not use
some form of end-to-end encryption (most likely, TLS), it violates the
expectations for security that the URI scheme implies.
</t>
<t>
Therefore, clients cannot blindly use alternative services, but instead evaluate
the option(s) presented to assure that security requirements and expectations
(of specifications, implementations and end users) are met.
</t>
</section>
<section title="Tracking Clients Using Alternative Services" anchor="tracking">
<t>
Choosing an alternative service implies connecting to a new, server-supplied
host name. By using many different (potentially unique) host names, servers
could conceivably track client requests. Such tracking could follow users
across multiple networks, when the "persist" flag is used.
</t>
<t>
Clients concerned by the additional fingerprinting can choose to
ignore alternative service advertisements.
</t>
<t>
In a user agent, any alternative service information &MUST; be removed when origin-specific data
is cleared (for instance, when cookies are cleared).
</t>
</section>
<section title="Confusion Regarding Request Scheme" anchor="confusion-regarding-request-scheme">
<t>
Alternative Services &MUST-NOT; be advertised for a protocol that is not
designed to carry the scheme. In particular, HTTP/1.1 over TLS cannot safely carry
requests for http resources.
</t>
</section>
</section>
</middle>
<back>
<references title="Normative References">
<reference anchor="RFC2119">
<front>
<title abbrev="RFC Key Words">Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials="S." surname="Bradner" fullname="Scott Bradner">
<organization>Harvard University</organization>
</author>
<date year="1997" month="March"/>
</front>
<seriesInfo name="BCP" value="14"/>
<seriesInfo name="RFC" value="2119"/>
</reference>
<reference anchor="RFC3986">
<front>
<title abbrev="URI Generic Syntax">Uniform Resource Identifier (URI): Generic Syntax</title>
<author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
<organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
</author>
<author initials="R." surname="Fielding" fullname="Roy T. Fielding">
<organization abbrev="Day Software">Day Software</organization>
</author>
<author initials="L." surname="Masinter" fullname="Larry Masinter">
<organization abbrev="Adobe Systems">Adobe Systems Incorporated</organization>
</author>
<date year="2005" month="January"/>
</front>
<seriesInfo name="STD" value="66"/>
<seriesInfo name="RFC" value="3986"/>
</reference>
<reference anchor='RFC5226'>
<front>
<title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
<author initials='T.' surname='Narten' fullname='T. Narten'/>
<author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'/>
<date year='2008' month='May' />
</front>
<seriesInfo name='BCP' value='26' />
<seriesInfo name='RFC' value='5226' />
</reference>
<reference anchor="RFC5234">
<front>
<title>Augmented BNF for Syntax Specifications: ABNF</title>
<author initials="D." surname="Crocker" fullname="D. Crocker"/>
<author initials="P." surname="Overell" fullname="P. Overell"/>
<date year="2008" month="January"/>
</front>
<seriesInfo name="STD" value="68"/>
<seriesInfo name="RFC" value="5234"/>
</reference>
<reference anchor="RFC5890">
<front>
<title>
Internationalized Domain Names for Applications (IDNA): Definitions and
Document Framework
</title>
<author initials="J." surname="Klensin" fullname="John Klensin"/>
<date year="2010" month="August"/>
</front>
<seriesInfo name="RFC" value="5890"/>
</reference>
<reference anchor="RFC6066">
<front>
<title>Transport Layer Security (TLS) Extensions: Extension Definitions</title>
<author initials="D." surname="Eastlake" fullname="D. Eastlake"/>
<date year="2011" month="January"/>
</front>
<seriesInfo name="RFC" value="6066"/>
</reference>
<reference anchor="RFC6454">
<front>