<commit_before>client_max_body_size 250m;

upstream unicorn {
  server unix:/tmp/.supermarket.sock.0;
}

server {
  listen 80 default_server;
  server_name <%= node['supermarket']['host'] %>;
<% if node['supermarket']['force_ssl'] -%>
  proxy_set_header        Host            $host;
  proxy_set_header        X-Real-IP       $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header        X-Forwarded-Proto https;
  proxy_pass_request_headers on;
  proxy_connect_timeout   90;
  proxy_send_timeout      90;
  proxy_read_timeout      90;
  location / {
    if ($http_x_forwarded_proto != 'https') {
      return 301 https://$server_name$request_uri;
    }
  }
}

<%   if node['supermarket']['allow_http_domain'] -%>
<%     node['supermarket']['allow_http_domain'].each do |domain| -%>
server {
  listen 80;
  server_name <%= domain %>;

  location ~ /sitemap\d*.xml.gz {
    root <%= node['supermarket']['home'] %>/current/public;

    break;
  }

  location ~ ^/(assets|system)/ {
    root <%= node['supermarket']['home'] %>/current/public;

    # to serve pre-gzipped version
    gzip_static on;
    expires 1y;
    add_header Cache-Control public;
    add_header ETag "";
    break;
  }

  location / {
    proxy_set_header HOST $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_pass http://unicorn;
    proxy_redirect off;

    # to serve gzipped text and json responses
    gzip on;
    gzip_min_length 1000;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/json;
  }
}
<%     end -%>
<%   end -%>

server {
  listen 443 ssl;
<%   if node['supermarket']['ssl_crt_path'] && node['supermarket']['ssl_key_path'] -%>
  ssl_certificate <%= node['supermarket']['ssl_crt_path'] %>;
  ssl_certificate_key <%= node['supermarket']['ssl_key_path'] %>;
  ssl_ciphers                   HIGH:!kEDH:!ADH:!MD5;
  ssl_prefer_server_ciphers     on;
  ssl_protocols                 SSLv3 TLSv1;
  ssl_session_cache             shared:SSL:4m;
  ssl_session_timeout           5m;
<%   end -%>
<% end -%>

  location ~ /sitemap\d*.xml.gz {
    root <%= node['supermarket']['home'] %>/current/public;

    break;
  }

  location ~ ^/(assets|system)/ {
    root <%= node['supermarket']['home'] %>/current/public;

    # to serve pre-gzipped version
    gzip_static on;
    expires 1y;
    add_header Cache-Control public;
    add_header ETag "";
    break;
  }

  location / {
    proxy_set_header HOST $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_pass http://unicorn;
    proxy_redirect off;

    # to serve gzipped text and json responses
    gzip on;
    gzip_min_length 1000;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/json;
  }
}<commit_msg>Correct the nginx X-Forwarded-Proto lines so that rails request.protocol is right<commit_after>client_max_body_size 250m;

upstream unicorn {
  server unix:/tmp/.supermarket.sock.0;
}

server {
  listen 80 default_server;
  server_name <%= node['supermarket']['host'] %>;
<% if node['supermarket']['force_ssl'] -%>
  proxy_set_header        Host            $host;
  proxy_set_header        X-Real-IP       $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header        X-Forwarded-Proto http;
  proxy_pass_request_headers on;
  proxy_connect_timeout   90;
  proxy_send_timeout      90;
  proxy_read_timeout      90;
  location / {
    if ($http_x_forwarded_proto != 'https') {
      return 301 https://$server_name$request_uri;
    }
  }
}

<%   if node['supermarket']['allow_http_domain'] -%>
<%     node['supermarket']['allow_http_domain'].each do |domain| -%>
server {
  listen 80;
  server_name <%= domain %>;

  location ~ /sitemap\d*.xml.gz {
    root <%= node['supermarket']['home'] %>/current/public;

    break;
  }

  location ~ ^/(assets|system)/ {
    root <%= node['supermarket']['home'] %>/current/public;

    # to serve pre-gzipped version
    gzip_static on;
    expires 1y;
    add_header Cache-Control public;
    add_header ETag "";
    break;
  }

  location / {
    proxy_set_header HOST $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_pass http://unicorn;
    proxy_redirect off;

    # to serve gzipped text and json responses
    gzip on;
    gzip_min_length 1000;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/json;
  }
}
<%     end -%>
<%   end -%>

server {
  listen 443 ssl;
<%   if node['supermarket']['ssl_crt_path'] && node['supermarket']['ssl_key_path'] -%>
  ssl_certificate <%= node['supermarket']['ssl_crt_path'] %>;
  ssl_certificate_key <%= node['supermarket']['ssl_key_path'] %>;
  ssl_ciphers                   HIGH:!kEDH:!ADH:!MD5;
  ssl_prefer_server_ciphers     on;
  ssl_protocols                 SSLv3 TLSv1;
  ssl_session_cache             shared:SSL:4m;
  ssl_session_timeout           5m;
<%   end -%>
<% end -%>

  location ~ /sitemap\d*.xml.gz {
    root <%= node['supermarket']['home'] %>/current/public;

    break;
  }

  location ~ ^/(assets|system)/ {
    root <%= node['supermarket']['home'] %>/current/public;

    # to serve pre-gzipped version
    gzip_static on;
    expires 1y;
    add_header Cache-Control public;
    add_header ETag "";
    break;
  }

  location / {
    proxy_set_header HOST $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    proxy_pass http://unicorn;
    proxy_redirect off;

    # to serve gzipped text and json responses
    gzip on;
    gzip_min_length 1000;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/json;
  }
}
{'fraction_non_alphanumeric': 0.1263709281388116, 'fraction_numerical': 0.011458503846783435, 'mean_word_length': 3.1283783783783785, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1200265', 'n_tokens_mistral': 2242, 'n_tokens_neox': 2083, 'n_words': 412}