← Back to list

Fix Chunked Transfer Encoding on WSGI — AWS Lightsail

Josiah Villanueva · 2021-05-15 12:02 · 0 claps · 0.5 min read
#chunked-transfer-encoding #content-length #411-content-length
Open on Medium ↗
Wiki topics: 💻 · Programming ☁️ · DevOps & Cloud

Fix Chunked Transfer Encoding on WSGI — AWS Lightsail

In this article we will discuss on how to resolve the issue the issue regarding Chunked Transfer Encoding or Status Code: 411 Length Required

Note:

Status Code: 411 Length Required error appeared on my web-app

Received Request requiring chunked transfer encoding, but optional support for the chunked transfer encoding, but optional support for the chunked transfer encoding has not been enabled: /var/www/html/{projectname}/{projectname.wsgi} error appeared on the WSGI error logs. To print the WSGI logs on Ubuntu.

Added the following on the WSGI file. WSGI file is located at the yourProjectDirectory/projectName

def chunked_reader():
    stream = flask.request.environ["wsgi.input"]
    try:
        while True:
            yield stream.next()
    except:
        return

Note: Do not forget to restart your apache using sudo service apache2 restart or sudo service apache2 reload


메타데이터
post_id
c479991fdaa1
slug
fix-chunked-transfer-encoding-on-wsgi-aws-lightsail-c479991fdaa1
url
https://medium.com/@josiahvillanueva/fix-chunked-transfer-encoding-on-wsgi-aws-lightsail-c479991fdaa1
canonical_url
https://medium.com/@josiahvillanueva/fix-chunked-transfer-encoding-on-wsgi-aws-lightsail-c479991fdaa1
author_url
https://medium.com/@josiahvillanueva
status
ok
fetched_at
2026-08-08 20:49:04