nuxt-proxy icon indicating copy to clipboard operation
nuxt-proxy copied to clipboard

500 error for ssr request,

Open hesamJafarzadeh opened this issue 11 months ago • 0 comments

hi there, i'm using nuxt-proxy and it works well on client-side, my mean is if you call a request on browser(for example submiting a form or clicking on a RouterLink) but it doesn't work if my request runs on server-side(for example when i refresh my page and i have a await useFetch() request on top of script setup) in this case it gives me error with 500 status code.

nuxt.config.ts

export default defineNuxtConfig({
  modules: ["nuxt-proxy"],
  proxy: {
    options: {
      target: "https://example.com",
      changeOrigin: true,
      pathRewrite: {
        "^/webapi": "/", 
      },
      pathFilter: ["/webapi/"],
    },
  },
....
})

i receive this error when i refresh my page and request runs on nuxt server-side http-proxy

but this request works fine on client-side How can I fix it? I want this to work on client-side and server-side

hesamJafarzadeh avatar Jul 27 '23 08:07 hesamJafarzadeh