import { Observable } from 'rxjs' ; import { Injectable , Inject } from '@angular/core' ; import { HttpEvent , HttpHandler , HttpInterceptor , HttpRequest } from '@angular/common/http' ; import { REQUEST } from '@nguniversal/express-engine/tokens' ; import * as xhr2 from 'xhr2' ; xhr2 . prototype . _restrictedHeaders = { } ; @ Injectable ( ) export class HttpUniversalInterceptor implements HttpInterceptor { constructor ( @ Inject ( REQUEST ) private req ) { } intercept ( req , next ) { const authReq = req . clone ( { setHeaders : { cookie : this . req . headers . cookie || '' } } ) ; return next . handle ( authReq ) ; } }