Changes between Version 24 and Version 25 of P9


Ignore:
Timestamp:
06/23/26 00:12:53 (3 days ago)
Author:
211099
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • P9

    v24 v25  
    886886    => await _dbSet.Where(c => c.StoryId == storyId).ToListAsync(cancellationToken);
    887887}}}
     888== CORS Configuration
     889ChapterX defines a CORS policy that restricts which origins are allowed to make requests to the API. Without this, any website could send requests on behalf of a logged-in user from their browser.
     890The policy is registered in Program.cs and applied globally before any other middleware:
     891{{{
     892builder.Services.AddCors(options =>
     893{
     894    options.AddPolicy("Frontend", policy =>
     895        policy.WithOrigins("http://localhost:5173", "https://localhost:5173")
     896              .AllowAnyHeader()
     897              .AllowAnyMethod());
     898});
     899app.UseCors("Frontend");
     900}}}
     901Only the frontend development server (localhost:5173) is whitelisted as an allowed origin. Requests originating from any other domain are rejected at the browser level before they reach any controller logic.
     902In a production environment, localhost:5173 should be replaced with the actual deployed frontend domain.