Skip to content

nuxt-auth-utils enforces Secure cookies in production, breaking local network deployments without HTTPS #520

@gbckempf-gif

Description

@gbckempf-gif

Description

When running a Nuxt application using nuxt-auth-utils in a production build, the module enforces Secure cookies.

This causes authentication to completely break in local network environments where HTTPS is not available.

Context

  • App is deployed in a local network
  • Uses a local domain (e.g. app.local, myapp, or similar)
  • No publicly trusted TLS certificate can be issued
  • Self-signed certificates are not a viable option due to browser warnings and usability constraints

Problem

nuxt-auth-utils sets cookies with the Secure flag when:

  • NODE_ENV=production

However:

  • Browsers reject Secure cookies over plain HTTP
  • Local domains (except localhost) are not treated as secure contexts
  • Result: session cookies are silently dropped

This makes authentication unusable in such environments.

Steps to reproduce

  1. Build the app:
    nuxi build

  2. Run in production:
    NODE_ENV=production node .output/server/index.mjs

  3. Access via local domain:
    http://app.local:3000

  4. Attempt login / session creation

Expected behavior

There should be a way to:

  • Disable Secure cookies explicitly
    or
  • Respect a configuration override (e.g. cookie.secure = false)

Actual behavior

  • Secure cookies are always enforced in production
  • Browser rejects cookies over HTTP
  • Authentication fails completely

Additional notes

Works only when:

  • using localhost (special browser handling), or
  • forcing NODE_ENV=development

Suggested solution

Allow an explicit override, e.g.:

auth: {
  cookie: {
    secure: false
  }
}

or:

allow opt-out for non-HTTPS environments

Use case justification

This affects:

  • internal tools
  • self-hosted apps
  • air-gapped environments
  • enterprise LAN deployments

In these scenarios, HTTPS is often not feasible, but authentication is still required.

Summary

Currently, nuxt-auth-utils cannot be used in production builds without HTTPS, which blocks valid local deployment scenarios.

A configurable fallback would make the module usable in a much wider range of environments.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions