{"id":15499653,"url":"https://github.com/mitar/chromium-1415291","last_synced_at":"2025-07-27T06:07:47.775Z","repository":{"id":220056648,"uuid":"668628013","full_name":"mitar/chromium-1415291","owner":"mitar","description":"Reproduction for https://bugs.chromium.org/p/chromium/issues/detail?id=1415291","archived":false,"fork":false,"pushed_at":"2023-07-20T08:48:28.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T13:24:41.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-07-20T08:48:18.000Z","updated_at":"2023-07-30T18:40:20.000Z","dependencies_parsed_at":"2024-01-31T04:28:04.239Z","dependency_job_id":"d8c93334-0526-41ec-b726-c9a95ba0b8d0","html_url":"https://github.com/mitar/chromium-1415291","commit_stats":null,"previous_names":["mitar/chromium-1415291"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitar%2Fchromium-1415291","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitar%2Fchromium-1415291/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitar%2Fchromium-1415291/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitar%2Fchromium-1415291/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitar","download_url":"https://codeload.github.com/mitar/chromium-1415291/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111799,"owners_count":21049571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T08:54:24.304Z","updated_at":"2025-04-09T20:48:32.010Z","avatar_url":"https://github.com/mitar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository is a reproduction for [Chromium issue 1415291](https://bugs.chromium.org/p/chromium/issues/detail?id=1415291).\nThe issue is that since Chromium disabled HTTP2 PUSH there is no way to preload content negotiated data (i.e., where data\ndepends on the `Accept` header) which is a problem when you have a server which serves both HTML and JSON at the same path\nand you want to preload JSON when HTML is requested.\n\nTo run, you should use [Go](https://go.dev/):\n\n```\ngo run main.go\n```\n\nAnd then open [http://localhost:8000/](http://localhost:8000/) in Chromium. Open network tab in DevTools.\n\n## Expected\n\nYou should see three requests being made very soon after the other, one for `/` for `text/html`, another for\n`/` for `application/json`, and another for `/data.json` for `application/json`. After 2 seconds that JSON data\nshould be shown in the page when JavaScript calls `fetch` and gets preloaded data without doing another\nserver equest.\n\n## Actual\n\nYou see three requests, one for `/`, anther for `/` and the third for `/data.json`, but all of them\n`text/html`. After 2 seconds no additional requests are made (good), but `fetch` gets HTML responses\nwhich are invalid JSON so error is shown in the page by JavaScript (bad).\n\n## Discussion\n\nThere are multiple issues here:\n\n- Preload requests are made with `Accept` set to `*/*` so HTML responses are returned. Instead,\n  `type=\"application/json\"` from `Link` header should be respected to load JSON responses.\n- When JavaScript calls `fetch` 2 seconds later, it is called with `Accept` header set to\n  `application/json` but Chromium still returns preloaded HTML content instead of doing another\n  request with `application/json`. So not just that performance is degraded (invalid and unnecessary\n  preloading of HTML is done) but also correctness of execution of the page is impacted.\n- No preloading happens if just `\u003c/\u003e; rel=\"preload\"; as=\"fetch\"; type=\"application/json\"; crossorigin=\"anonymous\"`\n  `Link` header is issued by the server. If both `\u003c/\u003e; rel=\"preload\"; as=\"fetch\"; type=\"application/json\"; crossorigin=\"anonymous\"`\n  and `\u003c/data.json\u003e; rel=\"preload\"; as=\"fetch\"; type=\"application/json\"; crossorigin=\"anonymous\"` headers are issued, then\n  both of them are preloaded. (This is the reason why I included additional `/data.json` loading. Originally the plan was\n  to have loading of HTML and JSON just from `/`.)\n\nTested on Chromium 114.0.5735.198.\n\nFirefox 115.0.2 behaves the same but it does not require two `Link` headers to load from `/` and\nit still has HTTP2 PUSH.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitar%2Fchromium-1415291","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitar%2Fchromium-1415291","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitar%2Fchromium-1415291/lists"}