This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from APItools/smart-router
introduce smart router on port 8080
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
server { | ||
listen 8080; | ||
ignore_invalid_headers off; | ||
|
||
location / { | ||
set $port "7071"; | ||
|
||
proxy_set_header Host $http_host; | ||
proxy_set_header Connection $http_connection; | ||
proxy_pass http://127.0.0.1:$port; | ||
|
||
access_by_lua_file 'lua/apps/router.lua'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local CONTAINS_DASH = "^(.*)%-([^.]+)" | ||
|
||
if string.match(ngx.var.http_host, CONTAINS_DASH) then | ||
ngx.var.port = 10002 | ||
else | ||
ngx.var.port = 7071 | ||
end |