From 57b007ffe24db490886b084a54734ce1613d9aa7 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Thu, 16 Jan 2020 17:43:10 +0100 Subject: [PATCH] fix referer url used for X-Requested-With header --- src/app/core/auth/server-auth.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/core/auth/server-auth.service.ts b/src/app/core/auth/server-auth.service.ts index f458fca8d4..31b99c94d2 100644 --- a/src/app/core/auth/server-auth.service.ts +++ b/src/app/core/auth/server-auth.service.ts @@ -53,9 +53,10 @@ export class ServerAuthService extends AuthService { const options: HttpOptions = Object.create({}); let headers = new HttpHeaders(); headers = headers.append('Accept', 'application/json'); - if (isNotEmpty(this.req.headers) && isNotEmpty(this.req.headers.referer)) { + if (isNotEmpty(this.req.protocol) && isNotEmpty(this.req.header('host'))) { + const referer = this.req.protocol + '://' + this.req.header('host') + this.req.path; // use to allow the rest server to identify the real origin on SSR - headers = headers.append('X-Requested-With', this.req.headers.referer); + headers = headers.append('X-Requested-With', referer); } options.headers = headers; return this.authRequestService.getRequest('status', options).pipe(