FunAndFriendly
How to reroute a request to a different template: GET /hello -> render(/foo/hello.vue)
Hi, when a request comes into the server, I want to check the hostname and decide which page to render.
How can I do that? I've looked at nuxt-multi-tenant module and it's possible, but that module uses dynamic routes. I have static routes.
Seems like this should be an easy win, but when I try to modify event.page in defineEventHandler() it's read-only. 😦 Howto? Thanks!
Seems like this should be an easy win, but when I try to modify event.page in defineEventHandler() it's read-only. 😦 Howto? Thanks!
6 replies
How to dynamically render a different page for a request. /pages/some/thing.vue or other/thing.vue
Hi, I'm trying to make a middleware like this - but setRequestURL() isn't a real thing and event.path is read-only.
Requirements:
1. no client-side redirects. I want to change the response for /some/thing 2. I need to dynamically decide to make the switch or not. I want to cache dynamic content - there are only two versions of GET /some/thing - /pages/some/thing.vue and /pages/other/thing.vue How to do this? Thank you!
1. no client-side redirects. I want to change the response for /some/thing 2. I need to dynamically decide to make the switch or not. I want to cache dynamic content - there are only two versions of GET /some/thing - /pages/some/thing.vue and /pages/other/thing.vue How to do this? Thank you!
6 replies