Advertisement
asanchez75

https

Oct 27th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # Added to generate https urls behind traefik proxy
  2. if (PHP_SAPI !== 'cli') {
  3. // Fix HTTPS if we're behind load balancer.
  4. if (getenv('HTTPS') !== 'on' && getenv('HTTP_X_FORWARDED_PROTO') === 'https') {
  5. $_SERVER['HTTPS'] = 'on';
  6. }
  7.  
  8. // Perform redirect to secure connection if needed.
  9. if ($_SERVER['HTTPS'] !== 'on') {
  10. header('HTTP/1.0 301 Moved Permanently');
  11. header('Location: https://'. getenv('HTTP_HOST') . getenv('REQUEST_URI'));
  12. exit;
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement