fix: 修复 chat dev 网关路由和认证头配置
This commit is contained in:
@@ -13,7 +13,7 @@ Hybrid:
|
||||
Auth:
|
||||
Enabled: true
|
||||
Source: envoy-header
|
||||
HeaderName: X-User-ID
|
||||
HeaderName: x-auth-user-id
|
||||
Wt:
|
||||
Addr: :8443
|
||||
Path: /wt/chat
|
||||
@@ -24,7 +24,7 @@ Hybrid:
|
||||
MaxConnections: 10000
|
||||
Auth:
|
||||
Enabled: true
|
||||
WsHeaderName: X-User-ID
|
||||
WsHeaderName: x-auth-user-id
|
||||
|
||||
Stateless:
|
||||
PollInterval: 100ms
|
||||
|
||||
@@ -13,13 +13,13 @@ Hybrid:
|
||||
Auth:
|
||||
Enabled: true
|
||||
Source: envoy-header
|
||||
HeaderName: X-User-ID
|
||||
HeaderName: x-auth-user-id
|
||||
FallbackStrategy: auto
|
||||
MaxRetries: 3
|
||||
MaxConnections: 10000
|
||||
Auth:
|
||||
Enabled: true
|
||||
WsHeaderName: X-User-ID
|
||||
WsHeaderName: x-auth-user-id
|
||||
|
||||
Stateless:
|
||||
PollInterval: 100ms
|
||||
|
||||
@@ -13,7 +13,7 @@ Hybrid:
|
||||
Auth:
|
||||
Enabled: true
|
||||
Source: envoy-header
|
||||
HeaderName: X-User-ID
|
||||
HeaderName: x-auth-user-id
|
||||
Wt:
|
||||
Addr: :8443
|
||||
Path: /wt/chat
|
||||
@@ -24,7 +24,7 @@ Hybrid:
|
||||
MaxConnections: 10000
|
||||
Auth:
|
||||
Enabled: true
|
||||
WsHeaderName: X-User-ID
|
||||
WsHeaderName: x-auth-user-id
|
||||
WtTokenSource: query
|
||||
WtTokenName: token
|
||||
WtJWTSecret: test-secret
|
||||
|
||||
@@ -34,13 +34,13 @@ async def test_ws():
|
||||
log("TEST", "=== WebSocket Chat Test Start ===")
|
||||
|
||||
log("WS", "connecting user1...")
|
||||
user1 = await websockets.connect(WS_URL, additional_headers={"X-User-ID": "1001"})
|
||||
user1 = await websockets.connect(WS_URL, additional_headers={"x-auth-user-id": "1001"})
|
||||
resp = await recv_json(user1)
|
||||
log("WS", f"user1 connected: {resp}")
|
||||
assert resp["type"] == "connected", f"expected connected, got {resp['type']}"
|
||||
|
||||
log("WS", "connecting user2...")
|
||||
user2 = await websockets.connect(WS_URL, additional_headers={"X-User-ID": "1002"})
|
||||
user2 = await websockets.connect(WS_URL, additional_headers={"x-auth-user-id": "1002"})
|
||||
resp = await recv_json(user2)
|
||||
log("WS", f"user2 connected: {resp}")
|
||||
assert resp["type"] == "connected"
|
||||
|
||||
@@ -37,7 +37,7 @@ async def test_wt_fallback():
|
||||
|
||||
log("WT", "--- Test 1: WT not configured, WS fallback should work ---")
|
||||
log("WT", "connecting via WS (fallback path)...")
|
||||
ws = await websockets.connect(WS_URL, additional_headers={"X-User-ID": "2001"})
|
||||
ws = await websockets.connect(WS_URL, additional_headers={"x-auth-user-id": "2001"})
|
||||
resp = await recv_json(ws)
|
||||
log("WT", f"fallback WS connected: {resp}")
|
||||
assert resp["type"] == "connected", f"expected connected, got {resp['type']}"
|
||||
@@ -80,7 +80,7 @@ async def test_wt_fallback():
|
||||
assert resp["type"] == "history"
|
||||
|
||||
log("WT", "--- Test 5: Multi-user over fallback ---")
|
||||
ws2 = await websockets.connect(WS_URL, additional_headers={"X-User-ID": "2002"})
|
||||
ws2 = await websockets.connect(WS_URL, additional_headers={"x-auth-user-id": "2002"})
|
||||
resp = await recv_json(ws2)
|
||||
assert resp["type"] == "connected"
|
||||
log("WT", "user2 connected via fallback WS")
|
||||
|
||||
@@ -309,6 +309,12 @@ static_resources:
|
||||
cluster: community_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
prefix: /api/v1/chat
|
||||
route:
|
||||
cluster: chat_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
path: /api/v1/upload
|
||||
route:
|
||||
@@ -728,6 +734,20 @@ static_resources:
|
||||
address: objectstory-api
|
||||
port_value: 8888
|
||||
|
||||
- name: chat_api_cluster
|
||||
connect_timeout: 2s
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: chat_api_cluster
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: chat-api
|
||||
port_value: 8888
|
||||
|
||||
- name: authz_adapter_cluster
|
||||
connect_timeout: 0.5s
|
||||
type: STRICT_DNS
|
||||
|
||||
Reference in New Issue
Block a user