You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: i18n/en/docusaurus-plugin-content-docs/version-2.0/apps/varnish.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,18 @@ import Meta from './_include/varnish.md';
29
29
30
30
4. Visiting the domain that Varnish is bound to, you can see that the access speed is greatly improved!
31
31
32
+
### Varnish blocks crawler access
33
+
34
+
1. Edit the relevant parameters in the Varnish application's `./src/default.vcl` file and add the following content, replacing `Sogou web spider` with the name of the crawler you want to block:
35
+
```
36
+
sub vcl_recv {
37
+
if (req.http.user-agent ~ “Sogou web spider”) {
38
+
return (synth(403, “Forbidden”));
39
+
}
40
+
}
41
+
```
42
+
2. After rebuilding the Varnish application, Varnish has been disabled for the crawler.
43
+
32
44
## Configuration options{#configs}
33
45
34
46
- Cache size: set via VARNISH_SIZE environment variable
0 commit comments