N
Nuxt16mo ago
Phillip

How to enforce redirecting to HTTPS?

I want to enforce HTTPS on a production environment (e.g. process.environment === 'prod'). I installed the redirect-ssl package but I'm not sure how to add it. I thought of serverMiddleware in the nuxt.config.ts but it's strike through. Any ideas?
No description
3 Replies
Fabian B.
Fabian B.16mo ago
Hi, check the docs on middleware. In nuxt 3, you don't have to define it in the config anymore. https://nuxt.com/docs/guide/directory-structure/server#server-middleware
Nuxt
server/
The server/ directory is used to register API and server handlers to your application.
Phillip
Phillip16mo ago
@Fabian B. thank you so much!
Fabian B.
Fabian B.16mo ago
No worries, glad it helped!