cancel
Showing results for 
Search instead for 
Did you mean: 

security cache

Balaji123
Champ in-the-making
Champ in-the-making

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 1

Prachi_Shah
Champ on-the-rise
Champ on-the-rise

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