Spaces:
Running
Running
Remove redundant Caddy auth block and use standard REA flags
Browse files- config/Caddyfile.example +1 -10
- services/15-supergateway.sh +15 -14
config/Caddyfile.example
CHANGED
|
@@ -1,14 +1,5 @@
|
|
| 1 |
:7860 {
|
| 2 |
-
# 1. REA MCP Server (Streamable HTTP via supergateway
|
| 3 |
-
@mcp_unauth {
|
| 4 |
-
path /mcp*
|
| 5 |
-
not header Authorization "Bearer @man.g"
|
| 6 |
-
not header X-API-Key "@man.g"
|
| 7 |
-
}
|
| 8 |
-
respond @mcp_unauth "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,\"message\":\"Unauthorized: valid Bearer token or X-API-Key required.\"},\"id\":null}" 401 {
|
| 9 |
-
close
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
handle /mcp* {
|
| 13 |
reverse_proxy 127.0.0.1:8093 {
|
| 14 |
flush_interval -1
|
|
|
|
| 1 |
:7860 {
|
| 2 |
+
# 1. REA MCP Server (Streamable HTTP via supergateway)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
handle /mcp* {
|
| 4 |
reverse_proxy 127.0.0.1:8093 {
|
| 5 |
flush_interval -1
|
services/15-supergateway.sh
CHANGED
|
@@ -38,10 +38,6 @@ if pgrep -f "supergateway.*8093" >/dev/null 2>&1; then
|
|
| 38 |
fi
|
| 39 |
|
| 40 |
API_KEY="${REA_API_KEY:-${AUTH_TOKEN:-}}"
|
| 41 |
-
if [ -z "$API_KEY" ]; then
|
| 42 |
-
echo "ERROR: REA_API_KEY or AUTH_TOKEN is required to start supergateway with auth" >> "$LOG"
|
| 43 |
-
exit 1
|
| 44 |
-
fi
|
| 45 |
|
| 46 |
cd /data/workspace || exit 1
|
| 47 |
CMD="/usr/local/bin/supergateway"
|
|
@@ -58,13 +54,18 @@ if [ -z "$CMD" ] || [ ! -x "$CMD" ]; then
|
|
| 58 |
exit 1
|
| 59 |
fi
|
| 60 |
|
| 61 |
-
|
| 62 |
-
--stdio "$REA_CMD mcp"
|
| 63 |
-
--outputTransport streamableHttp
|
| 64 |
-
--host 127.0.0.1
|
| 65 |
-
--port 8093
|
| 66 |
-
--streamableHttpPath /mcp
|
| 67 |
-
--healthEndpoint /healthz
|
| 68 |
-
--healthCheck server
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
fi
|
| 39 |
|
| 40 |
API_KEY="${REA_API_KEY:-${AUTH_TOKEN:-}}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
cd /data/workspace || exit 1
|
| 43 |
CMD="/usr/local/bin/supergateway"
|
|
|
|
| 54 |
exit 1
|
| 55 |
fi
|
| 56 |
|
| 57 |
+
ARGS=(
|
| 58 |
+
--stdio "$REA_CMD --mcp"
|
| 59 |
+
--outputTransport streamableHttp
|
| 60 |
+
--host 127.0.0.1
|
| 61 |
+
--port 8093
|
| 62 |
+
--streamableHttpPath /mcp
|
| 63 |
+
--healthEndpoint /healthz
|
| 64 |
+
--healthCheck server
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
if [ -n "$API_KEY" ]; then
|
| 68 |
+
ARGS+=(--apiKey "$API_KEY")
|
| 69 |
+
fi
|
| 70 |
+
|
| 71 |
+
exec "$CMD" "${ARGS[@]}" >> "$LOG" 2>&1
|