ws
Converts a WebSocket request into a new ws request (the server will receive the converted WebSocket URL).
Only supports WebSocket requests
ws[s]://domain[:port]/[path][?query]
. Transformation tunneling and plain HTTP/HTTPS are not supported.
Rule Syntax
txt
pattern ws://value [filters...]
Parameters | Description | Detailed Documentation |
---|---|---|
pattern | Expression to match WebSocket request URLs | Match Pattern Documentation |
value | Target URL format: domain[:port]/[path][?query] ⚠️ Loading data from files/remote URLs is not supported | Operation Instruction Documentation |
filters | Optional filters, supporting matching: • Request URL/Method/Headers/Content • Response Status Code/Headers | Filters Documentation |
WebSocket Transformation
txt
ws://www.example.com/path1 ws://www.test.com/path/xxx
wss://www.example.com/path2 ws://www.abc.com/path3/yyy
- Automatic path concatenation:
Original request Conversion result (URL received by the server) ws://www.example.com/path1
ws://www.test.com/path/xxx
ws://www.example.com/path1/a/b/c?query
ws://www.test.com/path/xxx/a/b/c?query
wss://www.example.com/path2
ws://www.abc.com/path3/yyy
wss://www.example.com/path2/a/b/c?query
ws://www.abc.com/path3/yyy/a/b/c?query
- Disable path concatenation: Use
< >
or()
to wrap the path.txtwww.example.com/path1 ws://<www.test.com/path/xxx> # www.example.com/path1 ws://(www.test.com/path/xxx)
Original Request Conversion Result (URL Received by the Server) [wss/ws]://www.example.com/path/x/y/z
ws://www.test.com/path/xxx
Only supports forwarding WebSocket requests; other requests match the ws
protocol. Result:
- Tunnel Proxy: Ignore matches
- Normal HTTP/HTTPS Request: Returns
502