1

in Angular 6/7, is there a way to read the request header on application load.

I need to read header values as Security access management set values in header while accessing angular app.

  export class AppComponent implements OnInit {

  ngOnInit(){
    // Read http request header here
   }
user2719441
  • 142
  • 1
  • 2
  • 10
  • 1
    The header of *what* request? And which headers? If they're security-related, they may not be accessible to *any* JavaScript. – jonrsharpe Feb 09 '19 at 18:06
  • Possible duplicate of [Accessing the web page's HTTP Headers in JavaScript](https://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript) – Maus Feb 09 '19 at 18:49
  • Header of the initial request of the application. It will be through a security management system like ISAM, where it will have the logged in users group information – user2719441 Feb 11 '19 at 06:57

1 Answers1

0

If you mean the headers the server sent up when it responded to the original browser request, it appears to me that only the cookies are available: you can retrieve them via document.cookie

Maus
  • 1,791
  • 1
  • 17
  • 28