Overview
Apinizer WebSocket proxy works exactly the same logic as HTTP APIs. You can route both HTTP and WebSocket requests through the same API Proxy.
Basic Concepts
Backend URL
The only required configuration. Specifies the address of your backend WebSocket service.Example:
http://backend:9090/ws/apiRelative Path
Works the same logic as HTTP APIs. You can perform flexible routing using wildcards.Examples:
/websocket/*, /chat/*Protocol Conversion
The system automatically performs protocol conversion:
http://→ws://https://→wss://
How It Works?
Unified Path Resolve Process
Path Resolve Example
Path Resolve Example
The following example shows how a WebSocket request is processed:
Path Resolve Steps
Path Resolve Steps
Processing of WebSocket requests goes through the following steps:
1
Query Separation
Query parameters are separated from the request path.
2
Path Normalization
Wildcard signs (
*) are cleaned.3
Remaining Path Calculation
API proxy path is extracted and the remaining path is determined.
4
Protocol Conversion
HTTP → WebSocket protocol conversion is performed (
http:// → ws://, https:// → wss://).5
URL Combination
Final URL is created by combining Backend URL + Remaining Path + Query parameters.
Practical Examples
HTTP and WebSocket Unified API Proxy
Routing both HTTP and WebSocket requests through the same API Proxy:Configuration:
- API Proxy:
/api/v1/* - Backend URL:
http://localhost:8080/service
- HTTP:
POST /api/v1/users→http://localhost:8080/service/users - WebSocket:
ws://host/api/v1/chat→ws://localhost:8080/service/chat
Secure Connection (WSS)
Secure WebSocket connection with HTTPS backend:Configuration:
- API Proxy:
/secure/* - Backend URL:
https://api.example.com/ws
- WebSocket:
ws://host/secure/data→wss://api.example.com/ws/data
WebSocket Chat Application
WebSocket proxy example for chat application:Configuration:
- API Proxy:
/chat/* - Backend URL:
http://chat-service:9090/websocket
- WebSocket:
ws://host/chat/room/123→ws://chat-service:9090/websocket/room/123
Frequently Asked Questions
Can the same API Proxy support both HTTP and WebSocket?
Can the same API Proxy support both HTTP and WebSocket?
Yes! Both protocols work under the same relative path.
Which protocol should I use in Backend URL?
Which protocol should I use in Backend URL?
Use HTTP or HTTPS. The system automatically converts to WS/WSS.
http:// or https:// protocol in Backend URL. Apinizer automatically performs conversion for WebSocket requests:http://→ws://https://→wss://
Are query parameters preserved?
Are query parameters preserved?
Yes, all query parameters are transferred to the backend as-is.
?param=value) in WebSocket requests are preserved and transferred to the backend. For example:How can I make my existing HTTP APIs WebSocket-enabled?
How can I make my existing HTTP APIs WebSocket-enabled?
1
Go to Environment Settings
Go to the settings of the environment that the API Proxy is connected to.
2
Enable WebSocket Support
Enable WebSocket support from environment settings.
3
Deploy
Deploy the changes. Your existing HTTP API Proxy will now also support WebSocket requests.

