nuxt / http

Universal HTTP Module for Nuxt.js
https://http.nuxtjs.org
MIT License
229 stars 51 forks source link

Sometimes 'Only absolute URLs are supported' error #169

Open NielsHavermans opened 3 years ago

NielsHavermans commented 3 years ago

Hi,

I'm using nuxt/http to fetch data from my API using a proxy. This for a replacement of axios due to CORS errors. Sometimes, not every time, I get this error during fetch ($fetchState.error): "message": "Only absolute URLs are supported", "statusCode": 500 This in dev and in build.

Fetch request async fetch() { const res = await fetch( '/product-api/products?id=XX&category=XX } this.product = await res.json() }

nuxt.config.js http: { retry: 1, proxy: true, prefix: "/product-api", }, proxy: { '/product-api': { target: 'https:///', pathRewrite: {'^/product-api': ''} } }

Does someone has the same problem, or is there anything wrong in my approach? Thanks!