Skip to content

500 error for ssr request, #27

@hesamJafarzadeh

Description

@hesamJafarzadeh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions