You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello - I'm new to hono and I'm wondering if someone can explain why requests to external hosts/URL is not working for me. Everything external returns "NOT FOUND". If i simply switch to a local route /local/test (local URL) it works fine and returns HTTP OK.
Here is the code:
import { Hono } from 'hono'
import { logger } from 'hono/logger'
import { cors } from 'hono/cors'
const app = new Hono()
const externalURL = "http://google.com";
const internalURL = "/local/test"
app.use('*', logger())
app.use('/external/*', cors())
app.get('/external', async(c) => {
/* CHANGING THIS CAUSES ANY EXTERNAL URL TO RETURN NOT FOUND */
//const res = await app.request(internalURL)
const res = await app.request(externalURL)
return c.text(`RESPONSE: ${res.statusText}`)
})
app.get('/local/test', (c) => {
return c.text('hello world')
})
export default app
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello - I'm new to hono and I'm wondering if someone can explain why requests to external hosts/URL is not working for me. Everything external returns "NOT FOUND". If i simply switch to a local route /local/test (local URL) it works fine and returns HTTP OK.
Here is the code:
Beta Was this translation helpful? Give feedback.
All reactions