fix: 修复前端-后端连接问题
- CORS 添加 localhost:5666 端口 - Cookie 改为 Secure=false, SameSite=Lax 适配 localhost 开发环境
This commit is contained in:
parent
f63482057b
commit
fb28bbdbe5
@ -25,8 +25,8 @@ public class LoginEndpoint(IMediator mediator) : Endpoint<LoginRequest, TokenRes
|
|||||||
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
|
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
|
||||||
{
|
{
|
||||||
HttpOnly = true,
|
HttpOnly = true,
|
||||||
Secure = true,
|
Secure = false,
|
||||||
SameSite = SameSiteMode.None,
|
SameSite = SameSiteMode.Lax,
|
||||||
Expires = DateTimeOffset.UtcNow.AddDays(7),
|
Expires = DateTimeOffset.UtcNow.AddDays(7),
|
||||||
Path = "/"
|
Path = "/"
|
||||||
});
|
});
|
||||||
|
|||||||
@ -31,8 +31,8 @@ public class RefreshTokenEndpoint(IMediator mediator) : EndpointWithoutRequest<s
|
|||||||
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
|
HttpContext.Response.Cookies.Append("jwt", result.RefreshToken, new CookieOptions
|
||||||
{
|
{
|
||||||
HttpOnly = true,
|
HttpOnly = true,
|
||||||
Secure = true,
|
Secure = false,
|
||||||
SameSite = SameSiteMode.None,
|
SameSite = SameSiteMode.Lax,
|
||||||
Expires = DateTimeOffset.UtcNow.AddDays(7),
|
Expires = DateTimeOffset.UtcNow.AddDays(7),
|
||||||
Path = "/"
|
Path = "/"
|
||||||
});
|
});
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class RAGApiModule : AbpModule
|
|||||||
{
|
{
|
||||||
options.AddDefaultPolicy(policy =>
|
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()
|
.AllowAnyHeader()
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowCredentials();
|
.AllowCredentials();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user