<commit_before># This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
use Rack::Deflater
run Rails.application

require 'rack/reverse_proxy'

use Rack::ReverseProxy do
  # Set :preserve_host to true globally (default is true already)
  reverse_proxy_options preserve_host: true

  # Forward the path /test* to http://example.com/test*
  reverse_proxy(/^\/gfw-assets\/?(.*)$/, "#{ENV['GFW_ASSETS_URL']}$1")
  reverse_proxy(/^\/howto(\/.*)$/, "http://vizzuality.github.io/gfw-howto$1")
  # reverse_proxy(/^\/howto(\/)?(.*)$/, "#{ENV['HOWTO_URL']}$1") => MIMETYPES DON'T WORK
end

if ENV['ACCESS'] == 'private'
  use Rack::Auth::Basic, "Restricted Area" do |username, password|
    username == ENV['ACCESS_USER']
    password  == ENV['ACCESS_PASSWORD']
  end
end
<commit_msg>fixed reverse proxy for gh-pages how-to<commit_after># This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
require 'rack/reverse_proxy'

use Rack::Deflater
use Rack::ReverseProxy do
  # Set :preserve_host to true globally (default is true already)
  reverse_proxy_options preserve_host: true

  # Forward the path /gfw-assets* to ENV['GFW_ASSETS_URL']*
  reverse_proxy(/^\/gfw-assets\/?(.*)$/, "#{ENV['GFW_ASSETS_URL']}$1")

  # Forward the path /howto/* to ENV['HOWTO_URL']/*
  reverse_proxy(/^\/howto(\/.*)$/, "#{ENV['HOWTO_URL']}$1")
end

if ENV['ACCESS'] == 'private'
  use Rack::Auth::Basic, "Restricted Area" do |username, password|
    username == ENV['ACCESS_USER']
    password  == ENV['ACCESS_PASSWORD']
  end
end

run Rails.application

{'fraction_non_alphanumeric': 0.17204301075268819, 'fraction_numerical': 0.002986857825567503, 'mean_word_length': 4.736301369863014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6553318', 'n_tokens_mistral': 602, 'n_tokens_neox': 577, 'n_words': 142}