Learn why HTTP/2 returns 0 bytes on IIS 10 server 2019. Our Litespeed Support team is here to help you with your questions and concerns.
Why HTTP/2 Returns 0 Bytes on IIS 10 Server 2019
HTTP/2 is a step above HTTP/1.1 and addresses the latter’s limitations. This modernized protocol improves how HTTP semantics are delivered over TCP connections, offering substantial performance gains.
Furthermore, it is accessible for a broad range of systems, with support for HTTP/2 included in Windows 10 and Windows Server 2016.
Let’s take a closer look at what HTTP/2 brings to the table and explore some of the challenges users might encounter when enabling it on Microsoft IIS.
What is HTTP/2?
HTTP/2 is a complete rework of the HTTP protocol’s underlying transport. The primary improvement over HTTP/1.1 is its ability to handle multiple simultaneous requests over a single persistent connection. While HTTP/1.1 allowed for persistent connections, each request had to wait its turn.
This is known as “head-of-line blocking.” HTTP/2 removes this limitation by introducing multiplexing, which allows multiple data streams to be sent in parallel over the same connection.
Other improvements in HTTP/2 include:
- Header compression: Reduces overhead by compressing HTTP headers.
- Stream prioritization: Helps manage the order of responses more efficiently.
- Binary framing layer: Converts HTTP messages into a binary format for faster processing.
Despite these benefits, enabling HTTP/2 in IIS can lead to unexpected behavior, particularly when server settings or third-party software interfere.
Problem Scenario: Enabling HTTP/2 on IIS
Consider a case where HTTP/2 is enabled in IIS by unchecking the “Disable HTTP/2” option in the port 443 bindings (HTTPS). In this setup, port 80 (HTTP) is disabled, and only secure connections are allowed.
Once HTTP/2 is enabled:
- Some users may notice that static files served from the IIS compression directory are returned as 0-byte files.
- This issue only appears when HTTP Static Compression is enabled.
- Also, requests fail silently or fall back to older behavior without triggering obvious errors.
You might also run into issues like authentication errors or limits being exceeded, like the “Maximum Request Length Exceeded” error in IIS“.
The primary cause of this error is antivirus software scanning the IIS compression directory. Also, this scanning process can lock or interfere with temporary files used during compression, resulting in incomplete or corrupted responses.
Additionally, improper group configurations, such as issues with the IIS_IUSRS
group, can lead to access-denied problems. Here’s a helpful guide on IIS_IUSRS and permission troubleshooting.
To fix this problem and ensure HTTP/2 functions correctly in our IIS environment, follow these steps:
- Modify the antivirus settings to exclude the IIS compression directory. The exact method will vary depending on the antivirus software we are using.
- The default locations for IIS compression directories are:
- IIS 6.0: `%systemroot%\IIS Temporary Compressed Files`
- IIS 7.0 and later: `%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files`
So, to check or modify this path, open IIS Manager, right-click Web Sites, and click Properties. Then, go to the Service tab. Under HTTP Compression, ensure “Compress static files” is enabled, and note the directory path.
- Additionally, we can use Failed Request Tracing to gain deeper insight into the request/response cycle and identify where problems may exist. This is especially useful for isolating errors like ERR_CONNECTION_REFUSED in IIS and similar HTTP-level issues.
Additional Tips
Even if compression issues are resolved, there are a few more limitations and behaviors to keep in mind when working with HTTP/2 in IIS:
- Windows Authentication: NTLM, Kerberos, and Negotiate authentication methods are not supported over HTTP/2. In such cases, IIS will automatically fall back to HTTP/1.1.
- TLS Requirement: IIS only supports HTTP/2 over HTTPS (TLS). Also, if clear text connections are attempted, IIS defaults to HTTP/1.1 again.
- Bandwidth Throttling: Furthermore, bandwidth limits configured in IIS (via the “Limits” option in site settings) apply only to HTTP/1.1 traffic. HTTP/2 requests ignore these settings.
- ISAPI Compatibility: If we use custom ISAPI extensions, ensure they’re updated to work with HTTP/2. Also, legacy code that writes headers and bodies using `WriteClient` must be refactored to use `ServerSupportFunction` with the `HSE_REQ_VECTOR_SEND` flag for HTTP/2 compatibility.
If you’re managing complex configurations or migrating settings between servers, it might help to export your IIS configuration using AppCmd to ensure consistency and avoid manual errors.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
HTTP/2 is a great upgrade that improves web application speed and efficiency. However, we must understand the configuration options and potential pitfalls when deploying on IIS.
In brief, our Support Experts demonstrated why HTTP/2 returns 0 bytes on an IIS 10 server in 2019 and how to avoid it.
0 Comments