Skip to content

Commit c0d5fc2

Browse files
committed
Send only headers on OPTIONS.
1 parent 36d837e commit c0d5fc2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/controllers/TimegateController.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ TimegateController.prototype._handleRequest = function (request, response, next)
4646
var self = this, timegateMatch = this._matcher.exec(request.url),
4747
datasource = timegateMatch && timegateMatch[1],
4848
timemapDetails = datasource && this._timemaps[datasource];
49+
50+
// Is this resource a well-configured timegate?
4951
if (timemapDetails) {
52+
// For OPTIONS (preflight) requests, send only headers (avoiding expensive lookups)
53+
if (request.method === 'OPTIONS')
54+
return response.end();
55+
5056
// Try to find the memento closest to the requested date
5157
var acceptDatetime = toDate(request.headers['accept-datetime']),
5258
memento = this._getClosestMemento(timemapDetails.timemap, acceptDatetime);

0 commit comments

Comments
 (0)