mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
fix: frontend API CORS (#10301)
This commit is contained in:
parent
51a895b660
commit
35db1b761e
@ -103,10 +103,7 @@ export default async function getApp(
|
||||
if (config.enableOAS && services.openApiService) {
|
||||
services.openApiService.useDocs(app);
|
||||
}
|
||||
// Support CORS preflight requests for the frontend endpoints.
|
||||
// Preflight requests should not have Authorization headers,
|
||||
// so this must be handled before the API token middleware.
|
||||
app.options(
|
||||
app.use(
|
||||
`${baseUriPath}/api/frontend*`,
|
||||
corsOriginMiddleware(services, config),
|
||||
);
|
||||
|
@ -19,7 +19,6 @@ import {
|
||||
} from '../../openapi/index.js';
|
||||
import type { Context } from 'unleash-client';
|
||||
import { enrichContextWithIp } from './index.js';
|
||||
import { corsOriginMiddleware } from '../../middleware/index.js';
|
||||
import NotImplementedError from '../../error/not-implemented-error.js';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
import { minutesToMilliseconds } from 'date-fns';
|
||||
@ -65,10 +64,6 @@ export default class FrontendAPIController extends Controller {
|
||||
functionName,
|
||||
});
|
||||
|
||||
// Support CORS requests for the frontend endpoints.
|
||||
// Preflight requests are handled in `app.ts`.
|
||||
this.app.use(corsOriginMiddleware(services, config));
|
||||
|
||||
this.route({
|
||||
method: 'get',
|
||||
path: '',
|
||||
|
Loading…
Reference in New Issue
Block a user