forked from baron/baron-sso
fix: use vite preview in staging to support api proxy in frontends
This commit is contained in:
@@ -18,8 +18,8 @@ if [ "${1:-}" = "--print-mode" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = "production" ]; then
|
if [ "$mode" = "production" ]; then
|
||||||
echo "Running in production mode..."
|
echo "Running in production mode with Vite preview..."
|
||||||
exec sh -c "npm run build && serve -s dist -l 5173"
|
exec sh -c "npm run build && npm run preview -- --host 0.0.0.0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running in development mode..."
|
echo "Running in development mode..."
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
envPrefix: ["VITE_", "USERFRONT_"],
|
envPrefix: ["VITE_", "USERFRONT_"],
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
allowedHosts: ["sadmin.hmac.kr", "localhost", "172.16.10.176"],
|
allowedHosts: ["sadmin.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
host: "0.0.0.0",
|
||||||
|
port: 5173,
|
||||||
|
allowedHosts: ["sadmin.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ if [ "${1:-}" = "--print-mode" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = "production" ]; then
|
if [ "$mode" = "production" ]; then
|
||||||
echo "Running in production mode..."
|
echo "Running in production mode with Vite preview..."
|
||||||
exec sh -c "npm run build && serve -s dist -l 5173"
|
exec sh -c "npm run build && npm run preview -- --host 0.0.0.0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running in development mode..."
|
echo "Running in development mode..."
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0", // Ensure binding to all interfaces
|
host: "0.0.0.0",
|
||||||
allowedHosts: ["sdev.hmac.kr", "localhost", "172.16.10.176"],
|
allowedHosts: ["sdev.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
host: "0.0.0.0",
|
||||||
|
port: 5173,
|
||||||
|
allowedHosts: ["sdev.hmac.kr", "localhost", "172.16.10.176", "127.0.0.1"],
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
target: process.env.API_PROXY_TARGET || "http://localhost:3000",
|
||||||
|
|||||||
Reference in New Issue
Block a user