Fix CORS: proxy WebRTC requests through backend
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user