Skip to content

Commit a5e8546

Browse files
rafbmcyu
authored andcommitted
Reduce default max_age to a more sensible value
Browsers cap the value of Access-Control-Max-Age, Chromium being the most aggressive at 2 hours: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age https://cs.chromium.org/chromium/src/services/network/public/cpp/cors/preflight_result.cc?rcl=49e7c0b4886cac1f3d09dc046bd528c9c811a0fa&l=28-31 It sounds logical to set a default value that all browsers will honor.
1 parent e4d4fc3 commit a5e8546

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/rack/cors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def initialize(public_resource, path, opts={})
338338

339339
self.path = path
340340
self.credentials = public_resource ? false : (opts[:credentials] == true)
341-
self.max_age = opts[:max_age] || 1728000
341+
self.max_age = opts[:max_age] || 7200
342342
self.pattern = compile(path)
343343
self.if_proc = opts[:if]
344344
self.vary_headers = opts[:vary] && [opts[:vary]].flatten

0 commit comments

Comments
 (0)