security cache

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

security cache

Hi,

I want to set cach setting for security perspective, so i want to set 'no-cache'  'must revalidate' and 'no store'. how can i set these value my configuration file  and which files can use for these changes. 

please sugguest me.

Thanks in advance.

1 Reply
Highlighted
Active Member

Re: security cache

Hi,

You can achieve this by doing these:

  1. Adding this meta tag in index.html file.

 

<meta http-equiv="cache-control" content="no-cache, must-revalidate,no-store">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">

    Or 2. You can create custome HTTPInterceptor to modify all requests in your application. like:

 intercept(req: HttpRequest<any>, next: HttpHandler) {
    const httpRequest = req.clone({
      headers: new HttpHeaders({
        'Cache-Control': 'no-cache,must-revalidate,no-store', 
'Pragma': 'no-cache'
})
});

 

Regards,
Prachi Shah| ContCentric