Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 896c4fc commit ac094d4Copy full SHA for ac094d4
1 file changed
ui/config/api.config.js
@@ -107,7 +107,11 @@ export function buildApiUrl(endpoint, params = {}) {
107
108
// Helper function to build WebSocket URLs
109
export function buildWsUrl(endpoint, params = {}) {
110
- const protocol = window.location.protocol === 'https:'
+ // Always use secure WebSocket (wss://) in production or when using HTTPS
111
+ // Use ws:// only for localhost development
112
+ const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
113
+ const isProduction = window.location.protocol === 'https:' || process.env.NODE_ENV === 'production';
114
+ const protocol = (isProduction || !isLocalhost)
115
? API_CONFIG.WSS_PREFIX
116
: API_CONFIG.WS_PREFIX;
117
0 commit comments