File tree 1 file changed +18
-11
lines changed
1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,32 @@ server {
6
6
return 444;
7
7
}
8
8
9
- # Only allow specific HTTP methods
10
- if ($request_method !~ ^(GET|POST|OPTIONS)$) {
9
+ # Only allow specific paths with specific methods
10
+ location ~ ^/(generate(/cost)?|modify)$ {
11
+
12
+ # Only allow specific methods
13
+ if ($request_method !~ ^(GET|POST|OPTIONS)$) {
14
+ return 444;
15
+ }
16
+
17
+ proxy_pass http://127.0.0.1:8000;
18
+ include proxy_params;
19
+ proxy_redirect off;
20
+ }
21
+
22
+ # Return 444 for all other requests
23
+ location / {
11
24
return 444;
12
25
}
13
26
14
- # Block these requests BEFORE the location / block
15
- location = /favicon.ico {
27
+ # Block common web crawling targets
28
+ location = /favicon.ico {
16
29
return 404;
17
30
access_log off;
18
31
log_not_found off;
19
32
}
20
33
21
- location = /robots.txt {
34
+ location = /robots.txt {
22
35
return 404;
23
36
access_log off;
24
37
log_not_found off;
@@ -31,12 +44,6 @@ server {
31
44
log_not_found off;
32
45
}
33
46
34
- location / {
35
- proxy_pass http://127.0.0.1:8000;
36
- include proxy_params;
37
- proxy_redirect off;
38
- }
39
-
40
47
# Add timeout settings
41
48
proxy_connect_timeout 300;
42
49
proxy_send_timeout 300;
You can’t perform that action at this time.
0 commit comments