Add capture '/git' (without a trailing slash) to rules

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-11 12:39:07 -07:00
parent 7b8413ae57
commit 54052e3890
2 changed files with 15 additions and 8 deletions

View File

@ -44,12 +44,12 @@ http {
return 301 http://miti.sh$request_uri; return 301 http://miti.sh$request_uri;
} }
location ~ ^/git/(.*)$ { location ~ ^/git/?(.*)$ {
return 301 https://git.miti.sh/ccm/$1; return 301 http://git.miti.sh/ccm/$1;
} }
location ~ ^/apps/(.*)$ { location ~ ^/apps/(.*)$ {
return 301 https://apps.miti.sh/$1; return 301 http://apps.miti.sh/$1;
} }
} }
} }

View File

@ -16,17 +16,24 @@ describe "http://webdevcat.me", ->
assert.same request\header!.Location, "http://miti.sh/" assert.same request\header!.Location, "http://miti.sh/"
describe "http://webdevcat.me/git", -> describe "http://webdevcat.me/git", ->
it "permanently redirects to http://git.miti.sh", -> it "permanently redirects to http://git.miti.sh/ccm/", ->
request = req "http://webdevcat.me/git" request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/" assert.same request\header!.Location, "http://git.miti.sh/ccm/"
describe "http://webdevcat.me/git/", -> describe "http://webdevcat.me/git/", ->
it "permanently redirects to http://git.miti.sh", -> it "permanently redirects to http://git.miti.sh", ->
request = req "http://webdevcat.me/git" request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/" assert.same request\header!.Location, "http://git.miti.sh/ccm/"
describe "http://webdevcat.me/git/pandoc/", -> describe "http://webdevcat.me/git/pandoc", ->
pending "permanently redirects to http://git.miti.sh/ccm/pandoc" it "permanently redirects to http://git.miti.sh/ccm/pandoc", ->
request = req "http://webdevcat.me/git/pandoc"
assert.same request\header!.Location, "http://git.miti.sh/ccm/pandoc"
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\header!.Location, "http://apps.miti.sh/btroops"
describe "http://miti.sh", -> describe "http://miti.sh", ->
it "sends /index.html", -> it "sends /index.html", ->