docs icon indicating copy to clipboard operation
docs copied to clipboard

Add docs (or potentially a recipe) for proxying requests from an endpoint

Open bholmesdev opened this issue 1 year ago • 4 comments

📚 Subject area/topic

SSR

📋 Suggested page

https://docs.astro.build/en/guides/endpoints/#server-endpoints-api-routes

📋 General description or bullet points (if proposing new content)

We received a roadmap discussion for adding better proxy support from API endpoints. Based on the replies, this is possible today by returning the result of a fetch() call. This capability is not documented, nor is it very intuitive. Would be worth an explicit guide on Proxying Requests.

🖥️ Reproduction of code samples in StackBlitz

No response

bholmesdev avatar Dec 12 '24 14:12 bholmesdev

Worth noting vite has an api for it too https://vite.dev/config/server-options#server-proxy

florian-lefebvre avatar Dec 12 '24 14:12 florian-lefebvre

This does sound like a great recipe that we can link to using our <RelatedRecipe/> component from the Endpoints page!

Putting a help wanted on this one in case anyone would like to put something together!

sarah11918 avatar Dec 13 '24 14:12 sarah11918

pinging for freshness! We would still happily accept some content about this!

sarah11918 avatar Jan 09 '25 13:01 sarah11918

I'll note there seems to be another way for manual usage, see the source of Hono proxy helper: https://github.com/honojs/hono/blob/main/src/helper/proxy/index.ts

florian-lefebvre avatar Feb 17 '25 09:02 florian-lefebvre