Change 'access-control-allow-origin' to FRONT_URL env variavle (#1567)

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
grégoire parant 2021-11-17 02:21:58 +01:00 committed by GitHub
parent 75ba9ddae8
commit 26fa566d85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@ export class BaseController {
protected addCorsHeaders(res: HttpResponse): void {
res.writeHeader("access-control-allow-headers", "Origin, X-Requested-With, Content-Type, Accept");
res.writeHeader("access-control-allow-methods", "GET, POST, OPTIONS, PUT, PATCH, DELETE");
res.writeHeader("access-control-allow-origin", "*");
res.writeHeader("access-control-allow-origin", FRONT_URL);
}
/**
@ -13,7 +13,6 @@ export class BaseController {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected errorToResponse(e: any, res: HttpResponse): void {
res.writeHeader("Access-Control-Allow-Origin", FRONT_URL);
if (e && e.message) {
let url = e?.config?.url;
if (url !== undefined) {