Azure / Azure/static-web-apps

Range requests for empty file return 400 with confusing error message

Open
#1,675 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

When serving range requests for an empty file, a 400 response is returned along with a body of:
> Range request support is not yet enabled for this site, please push an update to this site to enable this.

This prevents Front Door from serving the file with caching enabled as it always makes range requests.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a static web app containing an empty file e.g. `empty.js`.
2. Make a valid range request for that file e.g. `curl -v -H "Range: bytes=0-" "https://XXXX.azurestaticapps.net/empty.js"`
3. Observe the request fails with a 400 and the body above
4. Make a normal request for that file e.g. `curl -v "https://XXXX.azurestaticapps.net/empty.js"`
5. Observe the request succeeds

This URL can currently be used for testing, although I'm not sure how long it will remain working for: `curl -v -H "Range: bytes=0-" "https://icy-pond-0141bf203.1.azurestaticapps.net/chunk-GGQ7LRWG.js"`

**Expected behavior**
The range request succeeds with no content, or returns `416 Range Not Satisfiable` status (I'm not sure which is correct).

Front Door is able to serve the site with caching enabled.

**Screenshots**
N/A

**Device info (if applicable):**
N/A

**Additional context**
N/A

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.