diff --git a/BLUEHOST_VPS_DEPLOYMENT_GUIDE.md b/BLUEHOST_VPS_DEPLOYMENT_GUIDE.md index 02d27f8..7b396cf 100644 --- a/BLUEHOST_VPS_DEPLOYMENT_GUIDE.md +++ b/BLUEHOST_VPS_DEPLOYMENT_GUIDE.md @@ -1,4 +1,4 @@ -# 🚀 Complete Bluehost Ubuntu 24.04 VPS Hosting Guide for Freshers-Hub +![alt text](image.png)# 🚀 Complete Bluehost Ubuntu 24.04 VPS Hosting Guide for Freshers-Hub This guide provides a step-by-step walkthrough for deploying the entire **Freshers-Hub** project on a **Bluehost Ubuntu 24.04 VPS**. diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 5f6a038..29ea144 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -27,9 +27,8 @@ export const getBackendUrl = (path: string = ''): string => { return `${envUrl.endsWith('/') ? envUrl.slice(0, -1) : envUrl}${path}`; } const host = window.location.hostname; - const port = window.location.port; - // If running in production behind Nginx reverse proxy (standard port 80/443 or empty) - if (!port || port === '80' || port === '443') { + // If running in production build, always use relative routing + if (import.meta.env.PROD) { return path; } return `http://${host}:8085${path}`; @@ -41,9 +40,8 @@ export const getChatbotUrl = (path: string = ''): string => { return `${envUrl.endsWith('/') ? envUrl.slice(0, -1) : envUrl}${path}`; } const host = window.location.hostname; - const port = window.location.port; - // If running in production behind Nginx reverse proxy (standard port 80/443 or empty) - if (!port || port === '80' || port === '443') { + // If running in production build, always use relative routing + if (import.meta.env.PROD) { return path.startsWith('/api/chat') ? path : `/api/chat${path}`; } return `http://${host}:8081${path}`;