nuxt-alt / proxy

An alternative module to @nuxtjs/proxy
MIT License
24 stars 5 forks source link

SSR proxy get error #12

Closed cwe-spb closed 1 year ago

cwe-spb commented 1 year ago

Hi! I have a nuxt3 project. I use the url as site.com/test-api/feed/300 and the following is written in the proxy settings: '/test-api': { target: site2.com, changeOrigin: true, secure: false, rewrite: (path: string) => path.replace(/^\/test-api/, 'api') },

i get fault - TypeError [ERR_INVALID_URL]: Invalid URL

moreover, the proxy works correctly on the client. The problem is only from the server side. Thank you very much in advance for your help. This problem blocks further development. I will expect help

cwe-spb commented 1 year ago

upd: this work just with full URL. if i tried fetch with '/test-api/feed/300' -> error. 'https://site.com/test-api/feed/300' -> success.

TimGuendel commented 1 year ago

So... how did you fix this? 🤔Always call the whole URL?