We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Content-Length Error when IIS returns response with STATUS 302

    Jun 27, 2017 07:03 AM|s.jmacov|LINK

    I have small FastCGI application on Python+Flask. Server 2012 R2, IIS 8.5.

    When I return from handler redirect( url_for(...), 302)  in Python code, Flask returns response  with some html about "You will be redirected" and properly set Content-Length in response object.

    IIS see response status code 302 and add another html to response content before already added by Flask:

    <head><title>Document Moved</title></head>
    <body><h1>Object Moved</h1>This document may be found <a HREF="...">here</a></body>

    But IIS don't set right value of Content-Length after code insertion.

    As result my customers see in browser source code of page where redirection was targeted.

    What can I do to resolve this problem?