{"id":22496595,"url":"https://github.com/ernestofreyreg/dynamic-upstream-nginx","last_synced_at":"2026-05-15T22:05:29.412Z","repository":{"id":68121050,"uuid":"92955066","full_name":"ernestofreyreg/dynamic-upstream-nginx","owner":"ernestofreyreg","description":"Simple dynamic upstream demo for NGINX (not for production, just research) ","archived":false,"fork":false,"pushed_at":"2017-05-31T14:37:56.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T21:27:57.526Z","etag":null,"topics":["api","gateway","lua","nginx","serverless","upstream"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ernestofreyreg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-31T14:33:04.000Z","updated_at":"2018-01-05T22:20:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"7174e38d-10f3-4ed1-a117-bed9aeff694f","html_url":"https://github.com/ernestofreyreg/dynamic-upstream-nginx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ernestofreyreg/dynamic-upstream-nginx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernestofreyreg%2Fdynamic-upstream-nginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernestofreyreg%2Fdynamic-upstream-nginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernestofreyreg%2Fdynamic-upstream-nginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernestofreyreg%2Fdynamic-upstream-nginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ernestofreyreg","download_url":"https://codeload.github.com/ernestofreyreg/dynamic-upstream-nginx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernestofreyreg%2Fdynamic-upstream-nginx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008115,"owners_count":26084396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","gateway","lua","nginx","serverless","upstream"],"created_at":"2024-12-06T20:13:19.892Z","updated_at":"2025-10-11T17:21:17.767Z","avatar_url":"https://github.com/ernestofreyreg.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dymanic-upstream-nginx\n\nOpenresty implementation for a dynamic\nupstream implementation for nginx with support for routes and some extra features ;) \n\n*Requires docker to be installed and running.* \n\n```\n$ export HOSTIP=\u003cyour local IP address\u003e\n$ ./start.sh\n```\n\nThe **start** script requires `sudo` because we are trying to map restricted port 80\n\n## Internals\n\nThe **start** script will build a new docker image from openresty/latest\nincluding rules/code to make the backbone of revelatio architecture\nwork. This is an nginx service (backed with redis storage)\n\nA local `./data` folder will be created with the persistent state of \nthe redis storage. A local `./cache` folder will be created with the caching state of nginx.\n\n## Other scripts\n\n```\n$ ./shell.sh   # Opens a shell console on the nginx container\n```\n\n## How it works?\n\nOnce the server is running you can write your routing rules on redis by using redis-cli or \nany other tool.\n\n```\n$ redis-cli\n127.0.0.1:6379\u003e set \"route:my-web-app.com:/\" \"http://localhost:3500/\"\n127.0.0.1:6379\u003e set \"route:my-web-app.com:/api\" \"http://localhost:3501/\"\n```\n\nEach route should be set as `route:\u003cdomain\u003e:\u003cpath\u003e` and the value should be set to the \nupstream server.\n\nYou could also set deep nested routes, Ex: `route:my-web-app.com:/section/content/check` \nmeaning that any request coming to `http(s)://*.my-web-app.com/section/content/check(/*)` \nwill be routed to that upstream server.\n\n### Route Caching\n\nAll resolved routes to upstream servers are cached on redis. So, if you update a upstream \nserver route then you should delete also all matching cache keys with the form \n`routecache:\u003cdomain\u003e:\u003cresolved-route\u003e`. We are creating an admin CLI to handle\nthis automatically.\n\n\n## Why?\n\nIn short, Serverless. \n\n## Copyrights\n\nThis repo includes source code from:\n- https://github.com/cloudflare/lua-resty-cookie : Simply the best cookie api for Lua\n- https://github.com/mirven/underscore.lua : Super useful set of functions for handling with iterators, arrays, tables.\n- https://github.com/perusio/lua-resty-ffi-uuid : uuid generator based on libuuid1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernestofreyreg%2Fdynamic-upstream-nginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fernestofreyreg%2Fdynamic-upstream-nginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernestofreyreg%2Fdynamic-upstream-nginx/lists"}