{"id":19096641,"url":"https://github.com/sapcc/fernet-router","last_synced_at":"2026-06-18T08:31:43.665Z","repository":{"id":41954551,"uuid":"108290685","full_name":"sapcc/fernet-router","owner":"sapcc","description":"Reverse proxy routes keystone fernet-tokens to configurable backends","archived":false,"fork":false,"pushed_at":"2023-12-15T08:36:15.000Z","size":10,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-02-19T18:47:22.461Z","etag":null,"topics":["openstack","request-router","reverse-proxy"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sapcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-25T15:40:55.000Z","updated_at":"2020-09-04T11:56:49.000Z","dependencies_parsed_at":"2024-11-09T03:37:35.285Z","dependency_job_id":"66bc18e5-fc81-4717-82cd-410144db42cb","html_url":"https://github.com/sapcc/fernet-router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sapcc/fernet-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Ffernet-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Ffernet-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Ffernet-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Ffernet-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sapcc","download_url":"https://codeload.github.com/sapcc/fernet-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Ffernet-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34483275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"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":["openstack","request-router","reverse-proxy"],"created_at":"2024-11-09T03:37:22.359Z","updated_at":"2026-06-18T08:31:43.648Z","avatar_url":"https://github.com/sapcc.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fernet-Request-Router\n\nThe Fernet Request Router is a reverse proxy, which routes requests to various backends according to either user- or project-id stored in a keystone fernet token.\n\nThe administrator can define a number of ids and their associated backends, if no id matches, it falls back to the configured default backend.\n\nIt is maybe around 100 lines of lua script on top of openresty and luajit-msgpack-pure, and at this point more intended for development purposes than production use-cases.\n\n## Building\n\nRun `docker build .` and you'll have an image\n\n## Configuration\n\nThe configuration is expected under `/etc/fernet-router/local_init.lua`, but can be placed in any directory, which is in the lua search path.\nThe file is required on startup, and allows you to override most lookup functionality.\nBy default the fernet keys are expeced under `/fernet-keys/{0..N}`, and are only loaded on startup.\n\nLet's say, you want to get your own requests routed to your development hosts:\n```\n-- local_init.lua\n\nfunction default_upstream() return 'http://the-real-service.example.com' end\n\nuser_overrides[\"my-user-id-and-not-my-user-name\"] = \"http://my-development-host.example.com:8080\"\n\n```\n\nRestart nginx, and it could already work. If you see resolver errors, you probably have to change the resolver in the nginx.conf.\n\nMost functions can be replaced in your local config, so you can do something more dynamically.\nSay, you want to get the configuration out of a redis-db:\n```\n-- local_init.lua\nfunction default_upstream() return 'http://the-real-service.example.com' end\n\nlocal resty_redis = require \"resty.redis\"\n\nlocal function get(id)\n    local db = resty_redis:new()\n    local ok, err = db:connect(\"redis-db.example.com\", 6379)\n    if not ok then\n        ngx.log(ngx.WARN, \"Could not connect to redis due to \", err)\n        return\n    end\n    local res, err = db:get(id)\n    db:set_keepalive(60000, 5)\n    if not res then\n        ngx.log(ngx.WARN, \"Could not get value for \", id, \" due to \", err)\n    end\n    if res == ngx.null then\n        return\n    end\n    return res\nend\n\nfunction user_override(user) return get(\"fr:user:\" .. user) end\nfunction project_override(project) return get(\"fr:project:\" .. project) end\n```\n\nThat's all for now. Hope, it works for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapcc%2Ffernet-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsapcc%2Ffernet-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapcc%2Ffernet-router/lists"}