diff --git a/conf/nginx.conf b/conf/nginx.conf index 96f53c4..c94c2a9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -32,6 +32,21 @@ http { } } + server { + server_name git.miti.sh; + + location / { + client_max_body_size 1024M; + proxy_pass http://localhost:3000; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + 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 $scheme; + } + } + server { server_name apps.miti.sh; root /var/www/sites/apps.miti.sh; @@ -57,4 +72,14 @@ http { return 301 http://apps.miti.sh/$1; } } + + server { + server_name git.webdevcat.me; + return 301 http://git.miti.sh$request_uri; + } + + server { + server_name apps.webdevcat.me; + return 301 http://apps.miti.sh$request_uri; + } } diff --git a/spec/routes_spec.moon b/spec/routes_spec.moon index 97c9152..2f87fac 100644 --- a/spec/routes_spec.moon +++ b/spec/routes_spec.moon @@ -10,9 +10,7 @@ req = (url) -> describe "test environment", -> it "can't connect to the internet", -> - request = http.init "http://example.org" - assert.not_true request\perform! - assert.same request\lastError!, "Couldn't resolve host name" + assert.has_error (-> req "http://example.org"), "Couldn't resolve host name" describe "http://webdevcat.me", -> it "permanently redirects to http://miti.sh", -> @@ -24,21 +22,50 @@ describe "http://webdevcat.me", -> describe "http://webdevcat.me/git", -> it "permanently redirects to http://git.miti.sh/ccm/", -> request = req "http://webdevcat.me/git" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" assert.same request\header!.Location, "http://git.miti.sh/ccm/" describe "http://webdevcat.me/git/", -> it "permanently redirects to http://git.miti.sh", -> request = req "http://webdevcat.me/git" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" assert.same request\header!.Location, "http://git.miti.sh/ccm/" describe "http://webdevcat.me/git/pandoc", -> it "permanently redirects to http://git.miti.sh/ccm/pandoc", -> request = req "http://webdevcat.me/git/pandoc" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" assert.same request\header!.Location, "http://git.miti.sh/ccm/pandoc" +describe "http://git.webdevcat.me", -> + it "permanently redirects to http://git.miti.sh/", -> + request = req "http://git.webdevcat.me" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" + assert.same request\header!.Location, "http://git.miti.sh/" + describe "http://webdevcat.me/apps/btroops", -> it "permanently redirects to http://apps.miti.sh/btroops", -> request = req "http://webdevcat.me/apps/btroops" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" + assert.same request\header!.Location, "http://apps.miti.sh/btroops" + +describe "http://apps.webdevcat.me", -> + it "permanently redirects to http://apps.miti.sh/", -> + request = req "http://apps.webdevcat.me" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" + assert.same request\header!.Location, "http://apps.miti.sh/" + +describe "http://apps.webdevcat.me/btroops", -> + it "permanently redirects to http://apps.miti.sh/btroops", -> + request = req "http://apps.webdevcat.me/btroops" + assert.same request\statusCode!, 301 + assert.same request\statusMessage!, "Moved Permanently" assert.same request\header!.Location, "http://apps.miti.sh/btroops" describe "http://miti.sh", -> @@ -76,6 +103,14 @@ describe "http://miti.sh/posts", -> assert.same request\statusMessage!, "OK" assert.same request\body!\match("