Skip to content

Instantly share code, notes, and snippets.

@rwclarke
Created June 25, 2022 15:05
Show Gist options
  • Save rwclarke/747dbbb437588415fbcbd4ba6d54f3aa to your computer and use it in GitHub Desktop.
Save rwclarke/747dbbb437588415fbcbd4ba6d54f3aa to your computer and use it in GitHub Desktop.
export default defineEventHandler((event) => {
if (process.env.NODE_ENV === 'production' && event.req.headers['x-forwarded-proto'] !== 'https') {
sendRedirect(event, `https://${event.req.headers['host']}${event.req.url}`)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment