Fix CORS: proxy WebRTC requests through backend

This commit is contained in:
2026-01-30 22:49:10 -06:00
parent cebb9b6f28
commit a50393334a
3 changed files with 44 additions and 4 deletions

View File

@@ -273,8 +273,8 @@
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
// Send offer to go2rtc
const response = await fetch(`http://${GO2RTC_HOST}/api/webrtc?src=${cameraId}`, {
// Send offer to go2rtc via proxy
const response = await fetch(`/api/webrtc?src=${cameraId}`, {
method: 'POST',
headers: { 'Content-Type': 'application/sdp' },
body: offer.sdp
@@ -351,7 +351,7 @@
await pc.setLocalDescription(offer);
try {
const response = await fetch(`http://${GO2RTC_HOST}/api/webrtc?src=${cameraId}`, {
const response = await fetch(`/api/webrtc?src=${cameraId}`, {
method: 'POST',
headers: { 'Content-Type': 'application/sdp' },
body: offer.sdp