Fix: support coop FQDN for dashboard access

This commit is contained in:
Your Name
2026-04-18 02:10:06 +00:00
parent 4fba61f83b
commit 7e68f57d69
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -23,9 +23,15 @@ import { setupSocketHandlers } from './services/socket';
const app = express();
const httpServer = createServer(app);
const allowedOrigins = [
process.env.FRONTEND_URL,
'https://coop.hobokenchicken.com',
'http://172.20.1.238:3000'
].filter(Boolean) as string[];
const io = new Server(httpServer, {
cors: {
origin: process.env.FRONTEND_URL || 'http://localhost:3000',
origin: allowedOrigins,
credentials: true
}
});
@@ -35,7 +41,7 @@ app.use(helmet({
crossOriginResourcePolicy: { policy: "cross-origin" }
}));
app.use(cors({
origin: true, // Allow all origins in dev to fix the IP issue
origin: allowedOrigins,
credentials: true
}));
+1 -1
View File
@@ -1,6 +1,6 @@
import axios from 'axios';
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
const API_URL = process.env.NEXT_PUBLIC_API_URL || (typeof window !== 'undefined' ? `${window.location.origin}/api` : 'http://localhost:3001/api');
export const api = axios.create({
baseURL: `${API_URL}/api`,