lua-resty-cors
It's the implement of CORS on OpenResty (code is version 0.2.1~c78b9ea)
$ opm get detailyang/lua-resty-cors
Name
lua-resty-cors
lua-resty-cors
It's the implement of CORS on OpenResty and It backports the nginx-http-cors to OpenResty
allow_host
syntax: cors.allow_host(host)
This will match the host from cors request then be added to the header Access-Control-Allow-Origin like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Allow-Origin: http://www.google.com
expose_header
syntax: cors.expose_header(header)
This will be added to the header Access-Control-Expose-Headers like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Expose-Headers: x-custom-field1,x-custom-field2
allow_method
syntax: cors.allow_method(method)
This will be added to the header Access-Control-Allow-Methods like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Allow-Methods:GET,POST,PUT
allow_header
syntax: cors.allow_header(header)
This will be added to the header Access-Control-Allow-Headers like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Allow-Headers:x-custom-field1,x-custom-field2
max_age
syntax: cors.max_age(age)
This will be added to the header Access-Control-Max-Age like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Max-Age: 7200
Allow-Credentials
syntax: cors.allow_credentials(true or false)
This will be added to the header Access-Control-Allow-Credentials like as the following:
Request:
Origin: https://www.google.com
Response:
Access-Control-Allow-Credentials: true
run
syntax: cors.run()
This is the entry for lua-resty-cors to run
Contributing
To contribute to lua-resty-cors, clone this repo locally and commit your code on a separate branch.
PS: PR Welcome :rocket: :rocket: :rocket: :rocket:
Author
> GitHub @detailyang
License
lua-resty-cors is licensed under the [MIT] license.
[MIT]: https://github.com/detailyang/ybw/blob/master/licenses/MIT
Authors
Bingwu Yang (detailyang)
License
mit
Dependencies
ngx_http_lua
Versions
-
detailyang/lua-resty-cors 0.2.1.5It's the implement of CORS on OpenResty (code is version 0.2.1~c78b9ea) 2018-10-26 01:08:44
-
detailyang/lua-resty-cors 0.2.1.4It's the implement of CORS on OpenResty (code is version 0.2.1~c78b9ea) 2018-10-24 14:18:34
-
It's the implement of CORS on OpenResty 2016-10-10 13:41:18