feat(DevOps): add nginx reverse proxy

This commit is contained in:
patryk20120 2024-05-15 22:12:34 +02:00
parent 180e204c2d
commit 5b98be1644
No known key found for this signature in database
6 changed files with 92 additions and 8 deletions

View file

@ -141,7 +141,11 @@ const ChatWindow = () => {
const initialMessage = searchParams.get('q');
const [isReady, setIsReady] = useState(false);
const ws = useSocket(process.env.NEXT_PUBLIC_WS_URL!, setIsReady);
const publicHostname = typeof window !== 'undefined' && window.location.hostname;
const publicPort = typeof window !== 'undefined' && window.location.port;
const publicUrl = `${publicHostname}${publicPort ? `:${publicPort}` : ''}`;
const webSocketUrl = process.env.NEXT_PUBLIC_WS_URL || `ws://${publicUrl}/ws`;
const ws = useSocket(webSocketUrl, setIsReady);
const [chatHistory, setChatHistory] = useState<[string, string][]>([]);
const [messages, setMessages] = useState<Message[]>([]);