cors-anywhere icon indicating copy to clipboard operation
cors-anywhere copied to clipboard

Strip resource hints response header (Link)

Open Rob--W opened this issue 7 years ago • 0 comments

Preload resource hints result in unnecessary extra requests. To reduce the number of unnecessary requests, CORS Anywhere should strip or sanitize the Link response header:

For example, if you execute the following in Chrome:

fetch('https://cors-anywhere.herokuapp.com/https://bugzilla.mozilla.org/attachment.cgi?id=8896020')

then the server's (proxied) response includes the following header:

Link: </static/v20180412.2/skins/standard/fonts/FiraMono-Regular.woff2?v=3.202>; rel="preload"; as="font", </static/v20180412.2/skins/standard/fonts/FiraSans-Bold.woff2?v=4.203>; rel="preload"; as="font", </static/v20180412.2/skins/standard/fonts/FiraSans-Italic.woff2?v=4.203>; rel="preload"; as="font", </static/v20180412.2/skins/standard/fonts/FiraSans-Regular.woff2?v=4.203>; rel="preload"; as="font", </static/v20180412.2/skins/standard/fonts/FiraSans-SemiBold.woff2?v=4.203>; rel="preload"; as="font", </static/v20180412.2/skins/standard/fonts/MaterialIcons-Regular.woff2>; rel="preload"; as="font"

which results in many requests to /static/.... These responses are not really used and cause unnecessary extra load on the CORS Anywhere server. Therefore the Link response header should be stripped.

Rob--W avatar Apr 18 '18 13:04 Rob--W