upstream varnish {
  server localhost:7999;
}

server {
  server_name www.gov.uk www.<%= @platform %>.alphagov.co.uk www-origin.<%= @platform %>.alphagov.co.uk;
  listen 80 default_server;
  rewrite ^/(.*) https://$server_name/$1 permanent;
}

server {
  server_name         www.gov.uk;
  listen              443 ssl default_server;
  ssl_certificate     /etc/nginx/ssl/www.gov.uk.crt;
  ssl_certificate_key /etc/nginx/ssl/www.gov.uk.key;
  include             /etc/nginx/ssl.conf;

  include             /etc/nginx/router_routes.conf;
}

server {
  server_name         www.<%= @platform %>.alphagov.co.uk www-origin.<%= @platform %>.alphagov.co.uk;
  listen              443 ssl;
  ssl_certificate     /etc/nginx/ssl/www.<%= @platform %>.alphagov.co.uk.crt;
  ssl_certificate_key /etc/nginx/ssl/www.<%= @platform %>.alphagov.co.uk.key;
  include             /etc/nginx/ssl.conf;

  include             /etc/nginx/router_routes.conf;
}

upstream varnish {
  server localhost:7999;
}

server {
  server_name www.gov.uk www.<%= @platform %>.alphagov.co.uk www-origin.<%= @platform %>.alphagov.co.uk;
  listen 80 default_server;
  rewrite ^/(.*) https://$host/$1 permanent;
}

server {
  server_name         www.gov.uk;
  listen              443 ssl default_server;
  ssl_certificate     /etc/nginx/ssl/www.gov.uk.crt;
  ssl_certificate_key /etc/nginx/ssl/www.gov.uk.key;
  include             /etc/nginx/ssl.conf;

  include             /etc/nginx/router_routes.conf;
}

server {
  server_name         www.<%= @platform %>.alphagov.co.uk www-origin.<%= @platform %>.alphagov.co.uk;
  listen              443 ssl;
  ssl_certificate     /etc/nginx/ssl/www.<%= @platform %>.alphagov.co.uk.crt;
  ssl_certificate_key /etc/nginx/ssl/www.<%= @platform %>.alphagov.co.uk.key;
  include             /etc/nginx/ssl.conf;

  include             /etc/nginx/router_routes.conf;
}

Use requested host rather than canonical server name for redirect
Use requested host rather than canonical server name for redirect
