diff --git a/fastly.vcl b/fastly.vcl index 920bdf8..1fe8145 100644 --- a/fastly.vcl +++ b/fastly.vcl @@ -93,9 +93,12 @@ if (table.contains(solution_redirects, req.url.path)) { error 618 "redirect"; } +if (req.http.host ~ "^gems.") { + error 617 "https://rubygems.org"; +} + if (req.http.host ~ "^mocha.") { error 617 "https://github.com/freerange/mocha"; - # set req.url = regsub(req.url, "/", "/subcontent/"); } if (req.url.path ~ "^/projects/mocha/") { diff --git a/test.rb b/test.rb index 25ccb10..49c534d 100644 --- a/test.rb +++ b/test.rb @@ -11,6 +11,12 @@ def test_apex assert_equal "http://www.#{DOMAIN}/", response['Location'] end + def test_gems + response = request "gems.#{DOMAIN}" + assert_equal '308', response.code + assert_equal "https://rubygems.org", response['Location'] + end + def test_mocha_subdomain response = request "mocha.#{DOMAIN}" assert_equal '308', response.code