Opened 7 years ago

Last modified 7 years ago

#28786 closed Cleanup/optimization

Content-Length mismatch on Chrome — at Version 3

Reported by: spudnica Owned by: nobody
Component: Documentation Version: 1.11
Severity: Normal Keywords: content-length, commonMiddleware, development-server
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by spudnica)

Hi!

After updating to Django 1.11 I cant display pages in Chrome, due to error printed in Chrome console: net::ERR_CONTENT_LENGTH_MISMATCH

The above error does not occur in Mozilla or IE. When I delete lines responsible for Content-Length header from CommonMiddleware error disappears and my site works just fine.

Its not just mine Chrome, I tested issue on few PCs.

Change History (3)

comment:1 by spudnica, 7 years ago

Description: modified (diff)

comment:2 by Tim Graham, 7 years ago

I think we'll need more details about how to reproduce the problem.

in reply to:  2 comment:3 by spudnica, 7 years ago

Description: modified (diff)

Replying to Tim Graham:

I think we'll need more details about how to reproduce the problem.

  1. I guess the issue is related to way that content-length is calculated. If I manually set content-length to match particular page I request for, I am able to open this in Chrome. It seems that str(len(response.content)) is not returning proper reponse length i CommonMiddleware for me and firefox was just ignoring it.
  2. If I order CommonMiddleware at first place in my middlewares list, site is working properly, though it is against reccommendations in Django docs guide Middleware ordering.
  3. If i disable all middlewares that are added to site by myself, and place CommonMiddleware in right order, the error doesnt occur, so its realted to way how the length size calculated.
Last edited 7 years ago by spudnica (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top