{"id":5830,"date":"2020-12-27T14:43:34","date_gmt":"2020-12-27T18:43:34","guid":{"rendered":"https:\/\/www.dr-chuck.com\/csev-blog\/?p=5830"},"modified":"2020-12-28T11:06:04","modified_gmt":"2020-12-28T15:06:04","slug":"getting-apache2-mod_dir-redirect-to-http-instread-of-https-behind-load-balancer-like-cloudflare","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2020\/12\/getting-apache2-mod_dir-redirect-to-http-instread-of-https-behind-load-balancer-like-cloudflare\/","title":{"rendered":"Getting Apache2 mod_dir redirect to http instead of https behind load balancer like CloudFlare"},"content":{"rendered":"<p>So I use <strong>Cloudflare<\/strong> a lot to protect my servers, terminate SSL, and cache stuff at scale.\u00a0 One of the problems I run into is when the <strong>mod_dir<\/strong> module in my Apache thinks it is running http (which it is since Cloudflare is terminating my https) and Apache issues 301 redirects to http instead of https when you access a folder without a trailing slash.<\/p>\n<p>The solution on <strong>ubuntu<\/strong> is to edit:<\/p>\n<p>vi \/etc\/apache2\/sites-available\/000-default.conf<\/p>\n<p>And add a <strong>ServerName<\/strong> with an https:\/\/ like this:<\/p>\n<p>ServerName https:\/\/www.py4e.com<\/p>\n<p>And run <strong>apachectl restart<\/strong><\/p>\n<p>This is a problem when running Tsugi behind a loadbalancer.\u00a0 If you are using the tsugi-build approach &#8211; make sure to set the<strong> $APACHE_SERVER_NAME<\/strong> variable so it is automatically dropped in.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I use Cloudflare a lot to protect my servers, terminate SSL, and cache stuff at scale.\u00a0 One of the problems I run into is when the mod_dir module in my Apache thinks it is running http (which it is since Cloudflare is terminating my https) and Apache issues 301 redirects to http instead of [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5830","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=5830"}],"version-history":[{"count":5,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5830\/revisions"}],"predecessor-version":[{"id":5835,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5830\/revisions\/5835"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=5830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=5830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=5830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}