feat: add environment configuration files and update API base URL handling for production
This commit is contained in:
@@ -27,7 +27,12 @@ export function SocketProvider({ children }: SocketProviderProps) {
|
||||
const createSocket = useCallback(() => {
|
||||
if (!user) return null
|
||||
|
||||
const newSocket = io('http://localhost:8000', {
|
||||
// Get socket URL - use relative URL in production with reverse proxy
|
||||
const socketUrl = import.meta.env.PROD
|
||||
? '' // Use relative URL in production (same origin as frontend)
|
||||
: (import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000')
|
||||
|
||||
const newSocket = io(socketUrl, {
|
||||
withCredentials: true,
|
||||
transports: ['polling', 'websocket'],
|
||||
timeout: 20000,
|
||||
|
||||
Reference in New Issue
Block a user