I have a page that immediately starts streaming events upon load, via an EventSource. To speed up the start of that stream, I'd like to use HTTP preload meta tags. But when I add this to my page:
<link rel="preload" as="fetch" crossorigin="crossorigin" href="http://myeventsource" />
Chrome warns me:
A preload for 'http://myeventsource' is found, but is not used because the request headers do not match.
Which is true: the preload has an Accept
header of */*
, while the EventSource-originated request has an Accept
header of text/event-stream
. The reading I've been doing suggests that the content of that header is controlled by the as
parameter in the meta tag, but as far as I can see there is no eventstream-specific value.
Is there any way for me to override the Accept
header it's sending?