Skip to content

Commit d73e1e5

Browse files
committed
minor updates
- signed-off-by: trimstray <trimstray@gmail.com>
1 parent b984cf6 commit d73e1e5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/NGINX_BASICS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,10 @@ The `ngx_http_rewrite_module` also provides additional directives:
21032103
21042104
> _That’s actually not true and shows you don’t understand the problem with it. When the `if` statement ends with `return` directive, there is no problem and it’s safe to use._
21052105
2106+
On the other hand, official documentation say:
2107+
2108+
> _Directive if has problems when used in location context, in some cases it doesn’t do what you expect but something completely different instead. In some cases it even segfaults. It’s generally a good idea to avoid it if possible._
2109+
21062110
- `set` - sets a value for the specified variable. The value can contain text, variables, and their combination
21072111
21082112
Example of usage `if` and `set` directives:

doc/RULES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,12 +1911,16 @@ server {
19111911
19121912
###### Rationale
19131913
1914-
> When NGINX receives a request no matter what is the subdomain being requested, be it `www.example.com` or just the plain `example.com` this `if` directive is always evaluated. Since you’re requesting NGINX to check for the `Host` header for every request. It’s extremely inefficient.
1914+
> When NGINX receives a request no matter what is the subdomain being requested, be it `www.example.com` or just the plain `example.com` this `if` directive is always evaluated. Since you’re requesting NGINX to check for the `Host` header for every request. It might be extremely inefficient.
19151915
19161916
> Instead use two server directives like the example below. This approach decreases NGINX processing requirements.
19171917
19181918
> The problem is not just the `$server_name` directive. Keep in mind also other variables, e.g. `$scheme`. In some cases (but not always), it is better to add an additional block directive than to use the `if`.
19191919
1920+
On the other hand, official documentation say:
1921+
1922+
> _Directive if has problems when used in location context, in some cases it doesn’t do what you expect but something completely different instead. In some cases it even segfaults. It’s generally a good idea to avoid it if possible._
1923+
19201924
###### Example
19211925
19221926
Not recommended configuration:

0 commit comments

Comments
 (0)