using SERVER_DOMAIN at proxy target
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user