The list of header field names to send in the
Access-Control-Allow-Headers header in the preflight response.
Indicates the custom request headers that may be used in the
actual request.
Returns
(String) — the current value of headers
#headers=
defheaders=(value)->String
The list of header field names to send in the
Access-Control-Allow-Headers header in the preflight response.
Indicates the custom request headers that may be used in the
actual request.
Parameter
value (String) — the newly set value
Returns
(String) — the newly set value
#max_age
defmax_age()->String
The value to send in the
Access-Control-Max-Age header in the preflight response. Indicates
how many seconds the results of a preflight request can be cached
in a preflight result cache. The default value is 1800 (30
minutes.)
Returns
(String) — the current value of max_age
#max_age=
defmax_age=(value)->String
The value to send in the
Access-Control-Max-Age header in the preflight response. Indicates
how many seconds the results of a preflight request can be cached
in a preflight result cache. The default value is 1800 (30
minutes.)
Parameter
value (String) — the newly set value
Returns
(String) — the newly set value
#methods
defmethods()->String
The list of HTTP methods permitted in cross
origin resource sharing with the bucket. (GET, OPTIONS, POST, etc)
Note: "*" is permitted in the list of methods, and means
"any method".
Returns
(String) — the current value of methods
#methods=
defmethods=(value)->String
The list of HTTP methods permitted in cross
origin resource sharing with the bucket. (GET, OPTIONS, POST, etc)
Note: "*" is permitted in the list of methods, and means
"any method".
Parameter
value (String) — the newly set value
Returns
(String) — the newly set value
#origin
deforigin()->String
The origin
or origins permitted for cross origin resource sharing with the
bucket. Note: "*" is permitted in the list of origins, and means
"any Origin".
Returns
(String) — the current value of origin
#origin=
deforigin=(value)->String
The origin
or origins permitted for cross origin resource sharing with the
bucket. Note: "*" is permitted in the list of origins, and means
"any Origin".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Storage API - Class Google::Cloud::Storage::Bucket::Cors::Rule (v1.57.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.57.0 (latest)](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.56.0](/ruby/docs/reference/google-cloud-storage/1.56.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.55.0](/ruby/docs/reference/google-cloud-storage/1.55.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.54.0](/ruby/docs/reference/google-cloud-storage/1.54.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.53.0](/ruby/docs/reference/google-cloud-storage/1.53.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.52.0](/ruby/docs/reference/google-cloud-storage/1.52.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.51.0](/ruby/docs/reference/google-cloud-storage/1.51.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.50.0](/ruby/docs/reference/google-cloud-storage/1.50.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.49.0](/ruby/docs/reference/google-cloud-storage/1.49.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.48.1](/ruby/docs/reference/google-cloud-storage/1.48.1/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.47.0](/ruby/docs/reference/google-cloud-storage/1.47.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.46.0](/ruby/docs/reference/google-cloud-storage/1.46.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.45.0](/ruby/docs/reference/google-cloud-storage/1.45.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.44.0](/ruby/docs/reference/google-cloud-storage/1.44.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.43.0](/ruby/docs/reference/google-cloud-storage/1.43.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.42.0](/ruby/docs/reference/google-cloud-storage/1.42.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.41.0](/ruby/docs/reference/google-cloud-storage/1.41.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.40.0](/ruby/docs/reference/google-cloud-storage/1.40.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.39.0](/ruby/docs/reference/google-cloud-storage/1.39.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.38.0](/ruby/docs/reference/google-cloud-storage/1.38.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.37.0](/ruby/docs/reference/google-cloud-storage/1.37.0/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.36.2](/ruby/docs/reference/google-cloud-storage/1.36.2/Google-Cloud-Storage-Bucket-Cors-Rule)\n- [1.35.0](/ruby/docs/reference/google-cloud-storage/1.35.0/Google-Cloud-Storage-Bucket-Cors-Rule) \nReference documentation and code samples for the Cloud Storage API class Google::Cloud::Storage::Bucket::Cors::Rule.\n\nBucket Cors Rule\n----------------\n\nRepresents a website CORS rule for a bucket. Accessed via\n[Google::Cloud::Storage::Bucket#cors](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Bucket#Google__Cloud__Storage__Bucket_cors_instance_ \"Google::Cloud::Storage::Bucket#cors (method)\"). \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\nRetrieving the bucket's CORS rules. \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nbucket = storage.bucket \"my-bucket\"\nbucket.cors.size #=\u003e 2\nrule = bucket.cors.first\nrule.origin #=\u003e [\"http://example.org\"]\nrule.methods #=\u003e [\"GET\",\"POST\",\"DELETE\"]\nrule.headers #=\u003e [\"X-My-Custom-Header\"]\nrule.max_age #=\u003e 3600\n```\n\nMethods\n-------\n\n### #headers\n\n def headers() -\u003e String\n\nThe list of header field names to send in the\nAccess-Control-Allow-Headers header in the preflight response.\nIndicates the custom request headers that may be used in the\nactual request. \n**Returns**\n\n- (String) --- the current value of headers\n\n### #headers=\n\n def headers=(value) -\u003e String\n\nThe list of header field names to send in the\nAccess-Control-Allow-Headers header in the preflight response.\nIndicates the custom request headers that may be used in the\nactual request. \n**Parameter**\n\n- **value** (String) --- the newly set value \n**Returns**\n\n- (String) --- the newly set value\n\n### #max_age\n\n def max_age() -\u003e String\n\nThe value to send in the\nAccess-Control-Max-Age header in the preflight response. Indicates\nhow many seconds the results of a preflight request can be cached\nin a preflight result cache. The default value is `1800` (30\nminutes.) \n**Returns**\n\n- (String) --- the current value of max_age\n\n### #max_age=\n\n def max_age=(value) -\u003e String\n\nThe value to send in the\nAccess-Control-Max-Age header in the preflight response. Indicates\nhow many seconds the results of a preflight request can be cached\nin a preflight result cache. The default value is `1800` (30\nminutes.) \n**Parameter**\n\n- **value** (String) --- the newly set value \n**Returns**\n\n- (String) --- the newly set value\n\n### #methods\n\n def methods() -\u003e String\n\nThe list of HTTP methods permitted in cross\norigin resource sharing with the bucket. (GET, OPTIONS, POST, etc)\nNote: \"\\*\" is permitted in the list of methods, and means\n\"any method\". \n**Returns**\n\n- (String) --- the current value of methods\n\n### #methods=\n\n def methods=(value) -\u003e String\n\nThe list of HTTP methods permitted in cross\norigin resource sharing with the bucket. (GET, OPTIONS, POST, etc)\nNote: \"\\*\" is permitted in the list of methods, and means\n\"any method\". \n**Parameter**\n\n- **value** (String) --- the newly set value \n**Returns**\n\n- (String) --- the newly set value\n\n### #origin\n\n def origin() -\u003e String\n\nThe [origin](http://tools.ietf.org/html/rfc6454)\nor origins permitted for cross origin resource sharing with the\nbucket. Note: \"\\*\" is permitted in the list of origins, and means\n\"any Origin\". \n**Returns**\n\n- (String) --- the current value of origin\n\n### #origin=\n\n def origin=(value) -\u003e String\n\nThe [origin](http://tools.ietf.org/html/rfc6454)\nor origins permitted for cross origin resource sharing with the\nbucket. Note: \"\\*\" is permitted in the list of origins, and means\n\"any Origin\". \n**Parameter**\n\n- **value** (String) --- the newly set value \n**Returns**\n\n- (String) --- the newly set value"]]