Pre-flighted JavaScript requests
PUT request with max age
Summary
JavaScript code can make a cross-origin PUT
request.
The pre-flight response can include an Access-Control-Max-Age
header, causing the browser to cache the response for the specified number of seconds.
Instructions
- Press F12 to open browser Developer Tools
- Open Network tab and filter by path put-max-age
- Ensure Disable cache checkbox is not selected
- Hit green button below and observe 1 pre-flight and 1 main request
- Refresh page, hit button again, observing 0 pre-flight requests
- Wait until cache expires (60 seconds)
- Refresh page, hit button again, observing pre-flight request again
View source on GitHub | Created by Tom Gregory