Skip to content

Commit 895d32a

Browse files
authored
Fix header-based MCP auth (#120)
1 parent 6a734b2 commit 895d32a

File tree

1 file changed

+7
-34
lines changed

1 file changed

+7
-34
lines changed

docker/nginx.conf

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ http {
66
server {
77
listen 8080;
88

9-
# Alias common typo/variant: /{apiKey}/v1|v2/see -> /sse
10-
location ~ ^/(?<apikey>[^/]+)/v(?:1|2)/see$ {
11-
proxy_set_header X-Firecrawl-API-Key $apikey;
12-
proxy_set_header Host $host;
13-
9+
# Header-based with version: /v1|v2/{rest} (MUST COME BEFORE LEGACY)
10+
location ~ ^/v(?:1|2)/(.*)$ {
1411
proxy_buffering off;
1512
proxy_read_timeout 620s;
1613
proxy_send_timeout 620s;
17-
18-
rewrite ^/.*/see$ /sse break;
14+
proxy_set_header Host $host;
15+
proxy_set_header X-Forwarded-For $remote_addr;
16+
proxy_set_header X-Forwarded-Proto $scheme;
17+
rewrite ^/v(?:1|2)/(.*)$ /$1 break;
1918
proxy_pass http://app;
2019
}
2120

@@ -45,30 +44,6 @@ http {
4544
proxy_pass http://app;
4645
}
4746

48-
# Header-based with version alias: /v1|v2/see -> /sse
49-
location ~ ^/v(?:1|2)/see$ {
50-
proxy_buffering off;
51-
proxy_read_timeout 620s;
52-
proxy_send_timeout 620s;
53-
proxy_set_header Host $host;
54-
proxy_set_header X-Forwarded-For $remote_addr;
55-
proxy_set_header X-Forwarded-Proto $scheme;
56-
rewrite ^/v(?:1|2)/see$ /sse break;
57-
proxy_pass http://app;
58-
}
59-
60-
# Header-based with version: /v1|v2/{rest}
61-
location ~ ^/v(?:1|2)/(.*)$ {
62-
proxy_buffering off;
63-
proxy_read_timeout 620s;
64-
proxy_send_timeout 620s;
65-
proxy_set_header Host $host;
66-
proxy_set_header X-Forwarded-For $remote_addr;
67-
proxy_set_header X-Forwarded-Proto $scheme;
68-
rewrite ^/v(?:1|2)/(.*)$ /$1 break;
69-
proxy_pass http://app;
70-
}
71-
7247
# Direct header-based paths
7348
location /mcp {
7449
proxy_buffering off;
@@ -119,6 +94,4 @@ http {
11994
proxy_pass http://app/health;
12095
}
12196
}
122-
}
123-
124-
97+
}

0 commit comments

Comments
 (0)