fix: 修复前端-后端连接问题

- CORS 添加 localhost:5666 端口
- Cookie 改为 Secure=false, SameSite=Lax 适配 localhost 开发环境
This commit is contained in:
xiangning 2026-05-11 02:44:54 +08:00
parent f63482057b
commit fb28bbdbe5
3 changed files with 5 additions and 5 deletions

View File

@ -25,8 +25,8 @@ public class LoginEndpoint(IMediator mediator) : Endpoint<LoginRequest, TokenRes
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
{
HttpOnly = true,
Secure = true,
SameSite = SameSiteMode.None,
Secure = false,
SameSite = SameSiteMode.Lax,
Expires = DateTimeOffset.UtcNow.AddDays(7),
Path = "/"
});

View File

@ -31,8 +31,8 @@ public class RefreshTokenEndpoint(IMediator mediator) : EndpointWithoutRequest<s
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
{
HttpOnly = true,
Secure = true,
SameSite = SameSiteMode.None,
Secure = false,
SameSite = SameSiteMode.Lax,
Expires = DateTimeOffset.UtcNow.AddDays(7),
Path = "/"
});

View File

@ -45,7 +45,7 @@ public class RAGApiModule : AbpModule
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("http://localhost:5173", "http://localhost:5174", "http://localhost:3000")
policy.WithOrigins("http://localhost:5173", "http://localhost:5174", "http://localhost:3000", "http://localhost:5666")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();