| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 17 | public function handle($request, Closure $next) |
||
| 18 | { |
||
| 19 | $response = $next($request); |
||
| 20 | |||
| 21 | if ($response instanceof RedirectResponse) { |
||
| 22 | return $response; |
||
| 23 | } |
||
| 24 | |||
| 25 | $cacheDays = 182; //180 days minimum reccomended by SSL Labs |
||
| 26 | $maxAge = 60 * 60 * 24 * $cacheDays; |
||
| 27 | |||
| 28 | //Domains on which we want to serve the header |
||
| 29 | // be careful with this as it can't be undone |
||
| 30 | // the domain must always be available over https |
||
| 31 | $protectedHosts = ['monitor.vestd.com']; |
||
| 32 | |||
| 33 | if (in_array($request->getHttpHost(), $protectedHosts)) { |
||
| 34 | return $response->header('Strict-Transport-Security', 'max-age=' . $maxAge . '; preload'); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $response; |
||
| 38 | } |
||
| 39 | } |