denoland / website_feedback

For reporting issues & suggestions for deno.com and deno.land
9 stars 1 forks source link

deno.land/std@0.153.0 erroring with 404 every other request #30

Open jamiebuilds opened 1 year ago

jamiebuilds commented 1 year ago

This is happening very consistently for me

https://user-images.githubusercontent.com/952783/187500163-1a174ff8-7336-41b5-b984-1184876616b2.mov

lucacasonato commented 1 year ago

@jamiebuilds Thanks for the report. Could you include the response headers you are seeing for these requests in DevTools?

jamiebuilds commented 1 year ago

Yeah, looks like it occurs when trying to prefetch https://deno.land/std

Request 1: 200 ``` # General Request URL: https://deno.land/std@0.153.0 Request Method: GET Status Code: 200 Remote Address: 34.120.54.55:443 Referrer Policy: strict-origin-when-cross-origin # Response Headers content-encoding: gzip content-length: 26611 content-type: text/html; charset=utf-8 date: Tue, 30 Aug 2022 17:39:00 GMT server: deno/us-west2-b vary: Accept-Encoding # Request Headers :authority: deno.land :method: GET :path: /std@0.153.0 :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.9,la;q=0.8 cache-control: max-age=0 sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 ```
Request 2: 404 (from prefetch cache) ``` # General Request URL: https://deno.land/std@0.153.0 Request Method: GET Status Code: 404 (from prefetch cache) Remote Address: 34.120.54.55:443 Referrer Policy: strict-origin-when-cross-origin # Response Headers access-control-allow-origin: * content-length: 13 content-type: text/plain;charset=UTF-8 date: Tue, 30 Aug 2022 17:39:01 GMT server: deno/us-west2-b Timing-Allow-Origin: * vary: Accept-Encoding X-DNS-Prefetch-Control: off ```
Request 3: 200 ``` # General Request URL: https://deno.land/std@0.153.0 Request Method: GET Status Code: 200 Remote Address: 34.120.54.55:443 Referrer Policy: strict-origin-when-cross-origin # Response Headers content-encoding: gzip content-length: 26610 content-type: text/html; charset=utf-8 date: Tue, 30 Aug 2022 17:42:12 GMT server: deno/us-west2-a vary: Accept-Encoding # Request Headers :authority: deno.land :method: GET :path: /std@0.153.0 :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.9,la;q=0.8 cache-control: max-age=0 sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 ```
Request 4: 200 ``` # General Request URL: https://deno.land/std@0.153.0 Request Method: GET Status Code: 200 Remote Address: 34.120.54.55:443 Referrer Policy: strict-origin-when-cross-origin # Response Headers content-encoding: gzip content-length: 26607 content-type: text/html; charset=utf-8 date: Tue, 30 Aug 2022 17:42:12 GMT server: deno/us-west2-a vary: Accept-Encoding # Request Headers :authority: deno.land :method: GET :path: /std@0.153.0 :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.9,la;q=0.8 cache-control: max-age=0 sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 ```
Request 5: 404 (from prefetch cache) ``` # General Request URL: https://deno.land/std@0.153.0 Request Method: GET Status Code: 404 (from prefetch cache) Remote Address: 34.120.54.55:443 Referrer Policy: strict-origin-when-cross-origin # Response Headers access-control-allow-origin: * content-length: 13 content-type: text/plain;charset=UTF-8 date: Tue, 30 Aug 2022 17:42:13 GMT server: deno/us-west2-a Timing-Allow-Origin: * vary: Accept-Encoding X-DNS-Prefetch-Control: off ```
lucacasonato commented 1 year ago

Do you have any browser extensions installed? What version of Chrome(ium) is that? Are you opted into any of the recent Chrome prefetching experiments (specifically omnibox-zero-suggest-prefetching related ones)? We don't do any <link rel=prefetch ourselves, so I am trying to figure out what is causing the prefetch.

I think the root cause is that the prefetch request is sent with an Accept header that does not contain text/html.

lucacasonato commented 1 year ago

I am about 60% confident that this Chrome bug is the root cause: https://bugs.chromium.org/p/chromium/issues/detail?id=626081. It's quite interesting no one else has run into this so far. I think we can patch it by accepting Purpose: prefetch as an alias to content-type: text/html, but that is quite ugly :(

lucacasonato commented 1 year ago

@jamiebuilds Can you still reproduce on https://dotland-b044p0zhns7g.deno.dev/std@0.153.0 ?

jamiebuilds commented 1 year ago

Ah! I didn't have any flags, but I did have the Quicklink Chrome extension, I had forgotten about it. (Edit: I will also report to them)

It does still reproduce in your new branch

lucacasonato commented 1 year ago

Ok, I'll try with that extension!