feat: Add SECURE_SITE configuration and reverse proxy documentation

- Introduced the SECURE_SITE environment variable to control cookie security settings based on deployment context.
- Updated Dockerfile to log SECURE_SITE status during application startup.
- Enhanced documentation with a new guide on reverse proxy configuration, detailing the use of SECURE_SITE for secure cookie handling.
- Adjusted authentication and email services to utilize SECURE_SITE for secure connections.
- Updated frontend components to set cookie security based on the current protocol.
This commit is contained in:
Daniel Luiz Alves
2025-06-18 12:10:54 -03:00
parent 9afe8292fa
commit d2c69c3b36
10 changed files with 268 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import { LoginSchema, RequestPasswordResetSchema, createResetPasswordSchema } from "./dto";
import { AuthService } from "./service";
import { env } from "env";
import { FastifyReply, FastifyRequest } from "fastify";
export class AuthController {
@@ -17,8 +18,8 @@ export class AuthController {
reply.setCookie("token", token, {
httpOnly: true,
path: "/",
secure: false,
sameSite: "strict",
secure: env.SECURE_SITE === "true" ? true : false,
sameSite: env.SECURE_SITE === "true" ? "lax" : "strict",
});
return reply.send({ user });