Skip to content

Commit e98f5c5

Browse files
doc: Clarify ngx.req.set_header usage for proxies.
`ngx.req.set_header` acts similar `proxy_set_header` for `proxy_pass` scenarios. Co-authored-by: Zaar Hai
1 parent 5483b91 commit e98f5c5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5222,6 +5222,8 @@ For security considerations, this method will automatically escape " ", """, "("
52225222

52235223
By default, all the subrequests subsequently initiated by [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) will inherit the new header.
52245224

5225+
It is not a Lua's equivalent of nginx `proxy_set_header` directive (same is true about [ngx.req.clear_header](#ngxreqclear_header)). `proxy_set_header` only affects the upstream request while `ngx.req.set_header` change the incoming request. Record the http headers in the access log file will show the difference. But you still can use it as an alternative of nginx `proxy_set_header` directive as long as you know the difference.
5226+
52255227
Here is an example of setting the `Content-Type` header:
52265228

52275229
```lua

doc/HttpLuaModule.wiki

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4387,6 +4387,8 @@ For security considerations, this method will automatically escape " ", """, "("
43874387
43884388
By default, all the subrequests subsequently initiated by [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]] will inherit the new header.
43894389
4390+
It is not a Lua's equivalent of nginx `proxy_set_header` directive (same is true about [ngx.req.clear_header](#ngxreqclear_header)). `proxy_set_header` only affects the upstream request while `ngx.req.set_header` change the incoming request. Record the http headers in the access log file will show the difference. But you still can use it as an alternative of nginx `proxy_set_header` directive as long as you know the difference.
4391+
43904392
Here is an example of setting the <code>Content-Type</code> header:
43914393
43924394
<geshi lang="lua">

0 commit comments

Comments
 (0)