Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Use the webpack dev server proxy for requests

Gabe Kangas197f2feca7b0
diff --git a/controllers/status.go b/controllers/status.go
index 9b90525bc0..ce04ba7119 100644
--- a/controllers/status.go
+++ b/controllers/status.go
@@ -11,8 +11,6 @@ import (
// GetStatus gets the status of the server.
func GetStatus(w http.ResponseWriter, r *http.Request) {
- middleware.EnableCors(w)
-
status := core.GetStatus()
response := webStatusResponse{
Online: status.Online,
diff --git a/web/next.config.js b/web/next.config.js
index b0a42127e2..02bafbe2ac 100644
--- a/web/next.config.js
+++ b/web/next.config.js
@@ -2,4 +2,12 @@ const withLess = require('next-with-less');
module.exports = withLess({
trailingSlash: true,
+ async rewrites() {
+ return [
+ {
+ source: '/api/:path*',
+ destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
+ },
+ ];
+ },
});
diff --git a/web/services/chat-service.ts b/web/services/chat-service.ts
index a3dc9403ed..da4bb7fa37 100644
--- a/web/services/chat-service.ts
+++ b/web/services/chat-service.ts
@@ -1,7 +1,7 @@
import { ChatMessage } from '../interfaces/chat-message.model';
import { getUnauthedData } from '../utils/apis';
-const ENDPOINT = `http://localhost:8080/api/chat`;
-const URL_CHAT_REGISTRATION = `http://localhost:8080/api/chat/register`;
+const ENDPOINT = `/api/chat`;
+const URL_CHAT_REGISTRATION = `/api/chat/register`;
interface UserRegistrationResponse {
id: string;
diff --git a/web/services/status-service.ts b/web/services/status-service.ts
index f9f1b9c256..92cf3a7fb2 100644
--- a/web/services/status-service.ts
+++ b/web/services/status-service.ts
@@ -1,6 +1,6 @@
import ServerStatus from '../interfaces/server-status.model';
-const ENDPOINT = `http://localhost:8080/api/status`;
+const ENDPOINT = `/api/status`;
class ServerStatusService {
public static async getStatus(): Promise<ServerStatus> {