diff --git a/controllers/status.go b/controllers/status.go index 9b90525bc..ce04ba711 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 b0a42127e..02bafbe2a 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 a3dc9403e..da4bb7fa3 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 f9f1b9c25..92cf3a7fb 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 {