[backend/api] Allow CORS from all origins for FallbackController (ISH-301)
This commit is contained in:
parent
21c042453c
commit
ba15058e5c
2 changed files with 9 additions and 0 deletions
|
@ -2,6 +2,7 @@ using System.Net;
|
|||
using System.Net.Mime;
|
||||
using Iceshrimp.Shared.Schemas;
|
||||
using Iceshrimp.Backend.Core.Middleware;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
@ -9,6 +10,7 @@ namespace Iceshrimp.Backend.Controllers;
|
|||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public class FallbackController : ControllerBase
|
||||
{
|
||||
[EnableCors("fallback")]
|
||||
[ProducesResponseType(StatusCodes.Status501NotImplemented, Type = typeof(ErrorResponse))]
|
||||
public IActionResult FallbackAction()
|
||||
{
|
||||
|
|
|
@ -262,6 +262,13 @@ public static class ServiceExtensions
|
|||
.WithHeaders("Authorization", "Content-Type", "Idempotency-Key")
|
||||
.WithExposedHeaders("Link", "Connection", "Sec-Websocket-Accept", "Upgrade");
|
||||
});
|
||||
options.AddPolicy("fallback", policy =>
|
||||
{
|
||||
policy.WithOrigins("*")
|
||||
.WithMethods("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "CONNECT")
|
||||
.WithHeaders("Authorization", "Content-Type", "Idempotency-Key")
|
||||
.WithExposedHeaders("Link", "Connection", "Sec-Websocket-Accept", "Upgrade");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue