using SERVER_DOMAIN at proxy target

This commit is contained in:
Rafi
2023-04-10 18:15:18 +08:00
parent fe814acfd9
commit 8718dc4ed1
2 changed files with 2 additions and 3 deletions

View File

@@ -1,8 +1,7 @@
export const useMyFetch = (url, options = {}) => {
let defaultOptions = {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Accept: 'application/json'
}
}
if (process.server) {

View File

@@ -2,7 +2,7 @@ import { createProxyMiddleware } from 'http-proxy-middleware'
export default defineEventHandler(async (event) => {
await new Promise((resolve, reject) => {
createProxyMiddleware({
target: 'http://localhost:8001',
target: process.env.SERVER_DOMAIN,
pathFilter: '/api',
})(event.node.req, event.node.res, (err) => {
if (err)