Fix SSR 500 by proxying API requests to the Nuxt server port.
deploy to danak / build_and_deploy (push) Has been cancelled
deploy to danak / build_and_deploy (push) Has been cancelled
Point axios proxy at the same process as serverMiddleware instead of an unused port, and allow MongoDB URI to be configured via env. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-2
@@ -1,5 +1,6 @@
|
||||
const webpack = require('webpack');
|
||||
const serverport = 3711
|
||||
const nuxtPort = process.env.PORT || 3000
|
||||
|
||||
export default {
|
||||
head: {
|
||||
title: 'OrisOxin',
|
||||
@@ -74,7 +75,8 @@ export default {
|
||||
proxy: true
|
||||
},
|
||||
proxy: {
|
||||
'/api': { target: `http://0.0.0.0:${serverport}` }
|
||||
// SSR axios requests must hit the same Nuxt process that hosts serverMiddleware (/api).
|
||||
'/api': { target: `http://127.0.0.1:${nuxtPort}` }
|
||||
},
|
||||
router: {
|
||||
linkActiveClass: 'active-link',
|
||||
|
||||
Reference in New Issue
Block a user