File size: 1,298 Bytes
b43aff5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TASK_ID = "task7_nginx"
DIFFICULTY = "very_hard"
FILE_TYPE = "nginx"
NUM_BUGS = 3

DESCRIPTION = (
    "An nginx reverse proxy configuration with multi-step bugs. "
    "Requires fixing syntax (semicolons), directives (protocol), and routing logic (headers)."
)

# Bug 1 (Syntax): Missing semicolons in listen, error_log, and proxy_pass directives
# Bug 2 (Protocol): proxy_pass for / missing http:// protocol prefix
# Bug 3 (Routing): API endpoint missing headers
BROKEN_CONFIG = """events {}

http {
    server {
        listen 80

        location / {
            proxy_pass localhost:3000
        }

        location /api/ {
            proxy_pass http://localhost:5000
        }

        error_log logs/error.log
    }
}"""

ERROR_MESSAGE = (
    "nginx configuration has syntax, directive, and routing errors: "
    "missing semicolons, missing http:// prefix in proxy_pass, and missing required headers in API routing."
)

GROUND_TRUTH = """events {}

http {
    server {
        listen 80;

        location / {
            proxy_pass http://localhost:3000;
        }

        location /api/ {
            proxy_pass http://localhost:5000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        error_log logs/error.log;
    }
}"""