Skip to content

Commit f2b2f27

Browse files
committed
Updated README for changes to http-request and http-response lines that allow sharing allowed methods and allowed origins between the two stages by using a Lua private variable.
1 parent 2945342 commit f2b2f27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ global
2929
lua-load /path/to/cors.lua
3030
```
3131

32-
In your `frontend` or `listen` section, capture the client's *Origin* request header by adding `http-request lua.cors`:
32+
In your `frontend` or `listen` section, capture the client's *Origin* request header by adding `http-request lua.cors` The first parameter is a comma-delimited list of HTTP methods that can be used. The second parameter is comma-delimited list of origins that are permitted to call your service.
3333

3434
```
35-
http-request lua.cors
35+
http-request lua.cors "GET,PUT,POST" "example.com,localhost,localhost:8080"
3636
```
3737

38-
Within the same section, invoke the `http-response lua.cors` action. The first parameter is a a comma-delimited list of HTTP methods that can be used. The second parameter is comma-delimited list of origins that are permitted to call your service.
38+
Within the same section, invoke the `http-response lua.cors` action to attach CORS headers to responses from backend servers.
3939

4040
```
41-
http-response lua.cors "GET,PUT,POST" "example.com,localhost,localhost:8080"
41+
http-response lua.cors
4242
```
4343

4444
You can also whitelist all domains by setting the second parameter to an asterisk:

0 commit comments

Comments
 (0)