Redirect http requests to https
authorGuillaume RISCHARD <git@stereo.lu>
Fri, 1 Jun 2018 11:31:04 +0000 (13:31 +0200)
committerTom Hughes <tom@compton.nu>
Sun, 3 Jun 2018 18:37:30 +0000 (19:37 +0100)
cookbooks/squid/templates/default/squid.conf.erb
cookbooks/tilecache/recipes/default.rb
cookbooks/tilecache/templates/default/nginx_tile.conf.erb [moved from cookbooks/tilecache/templates/default/nginx_tile_ssl.conf.erb with 94% similarity]

index f290f730d22b16f7f1174f435a03dc0e3552d064..0c54aae82c23026013a849a13242ccb9fc449836 100644 (file)
@@ -12,7 +12,7 @@ icp_port 3130
 log_icp_queries off
 
 #FIXME - configurable
-http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
+http_port 127.0.0.1:8080 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
 
 cache_effective_user proxy
 cache_effective_group proxy
index 0d94bcfd26a3cfb21048e053f1307cf307527133..d1773b506cb409b4d50d216f467810ced0ec13d5 100644 (file)
@@ -118,7 +118,11 @@ ssl_certificate "tile.openstreetmap.org" do
 end
 
 nginx_site "tile-ssl" do
-  template "nginx_tile_ssl.conf.erb"
+  action :delete
+end
+
+nginx_site "tile" do
+  template "nginx_tile.conf.erb"
   variables :caches => tilecaches
 end
 
similarity index 94%
rename from cookbooks/tilecache/templates/default/nginx_tile_ssl.conf.erb
rename to cookbooks/tilecache/templates/default/nginx_tile.conf.erb
index ac62a3775c07c5e6564a19374f93b059fd3e904f..149ddd0018ede1b6b829c4e0c5bcdbb5523af6f8 100644 (file)
@@ -1,7 +1,7 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 upstream tile_cache_backend {
-    server 127.0.0.1;
+    server 127.0.0.1:8080;
     <% @caches.each do |cache| -%>
     <% if cache[:hostname] != node[:hostname] -%>
     #Server <%= cache[:hostname] %>
@@ -96,3 +96,11 @@ server {
       proxy_set_header Pragma $limit_http_pragma;
     }
 }
+
+# Convert all http requests to https
+server {
+    listen 80 default_server;
+    listen [::]:80 default_server;
+    server_name _;
+    return 301 https://$host$request_uri;
+}