NuxtN
Nuxt14mo ago
21 replies
HardWare

$fetch and useFetch proxy request receive strange binary instead proper json+ld object

Hi, I am using nuxt reverse proxy mothode made by Alexander Lichter, but data is corrupted on client-site.
https://www.youtube.com/watch?v=J4E5uYz5AY8
How correct json should looks like:
const dd = await $fetch('/api/rocket/gallery',)
console.log(dd)
{
    "@context": "/contexts/Gallery",
    "@id": "/rocket/gallery",
    "@type": "Collection",
    "totalItems": 0,
    "member": []
}

Im using docker containers so my server-site api endpoint is http://php/rocket/gallery
Traffic is like nuxt-clinet -> nuxt-api -> backend-api
image.png
image.png
image.png
YouTubeAlexander Lichter
➡️ Proxying routes to your back-end or third party APIs is a common practice! Over the last two years, various strategies came up in Nuxt. But not all of them work equally will. To figure out which two strategies are the recommended ones, we have a look at the four most common strategies, their shortcomings and which ones I would recommend to us...
The BEST way to proxy your API in Nuxt
Was this page helpful?