Content-Length: 272252 | pFad | https://github.com/vitejs/vite/commit/74a79c53b2286c91739d1473945012b5d206eddf

8B fix: backport #17997, ensure req.url matches moduleByEtag URL to avoi… · vitejs/vite@74a79c5 · GitHub
Skip to content

Commit 74a79c5

Browse files
fix: backport #17997, ensure req.url matches moduleByEtag URL to avoid incorrect 304 (#18078)
Co-authored-by: coderwei <65948611+coderwei99@users.noreply.github.com>
1 parent d90ba40 commit 74a79c5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/vite/src/node/server/middlewares/transform.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export function cachedTransformMiddleware(
5252
const ifNoneMatch = req.headers['if-none-match']
5353
if (ifNoneMatch) {
5454
const moduleByEtag = server.moduleGraph.getModuleByEtag(ifNoneMatch)
55-
if (moduleByEtag?.transformResult?.etag === ifNoneMatch) {
55+
if (
56+
moduleByEtag?.transformResult?.etag === ifNoneMatch &&
57+
moduleByEtag?.url === req.url
58+
) {
5659
// For CSS requests, if the same CSS file is imported in a module,
5760
// the browser sends the request for the direct CSS request with the etag
5861
// from the imported CSS module. We ignore the etag in this case.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/vitejs/vite/commit/74a79c53b2286c91739d1473945012b5d206eddf

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy