{"id":20955099,"url":"https://github.com/myunisoft/loki-reverse-proxy","last_synced_at":"2026-05-20T03:37:32.913Z","repository":{"id":229080428,"uuid":"775678801","full_name":"MyUnisoft/loki-reverse-proxy","owner":"MyUnisoft","description":"Reverse proxy for Loki with proper Grafana API authentication","archived":false,"fork":false,"pushed_at":"2025-03-10T21:21:59.000Z","size":337,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T22:26:24.826Z","etag":null,"topics":["api","authenticated","authentication","grafana","loki","proxy","reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MyUnisoft.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-21T20:50:21.000Z","updated_at":"2025-03-10T21:21:56.000Z","dependencies_parsed_at":"2024-03-27T18:37:12.458Z","dependency_job_id":"b24b86ee-b4b4-47b4-8f46-15e1e8f04c4c","html_url":"https://github.com/MyUnisoft/loki-reverse-proxy","commit_stats":null,"previous_names":["myunisoft/loki-reverse-proxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MyUnisoft%2Floki-reverse-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MyUnisoft%2Floki-reverse-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MyUnisoft%2Floki-reverse-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MyUnisoft%2Floki-reverse-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MyUnisoft","download_url":"https://codeload.github.com/MyUnisoft/loki-reverse-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243351862,"owners_count":20276911,"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","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","authenticated","authentication","grafana","loki","proxy","reverse-proxy"],"created_at":"2024-11-19T01:17:59.130Z","updated_at":"2026-05-20T03:37:27.893Z","avatar_url":"https://github.com/MyUnisoft.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loki-reverse-proxy\nReverse proxy for Loki API with proper Grafana API token authentication.\n\nUnder the hood it use Grafana `/api/auth/keys` API to validate the token and then dispatch the request to Loki. \n\n\u003e [!CAUTION]\n\u003e When succesfully authenticated, by default tokens are cached for 5 minutes\n\n## Getting started\n\n```bash\n$ git clone https://github.com/MyUnisoft/loki-reverse-proxy.git\n$ cd loki-reverse-proxy\n$ npm ci\n$ npm run build\n```\n\n### Environment Variables\n\nTo configure the project you have to register (set) environment variables on your system. These variables can be set in a .env file (that file must be created at the root of the project).\n\n```ini\nGRAFANA_URL=\"\"\nLOKI_URL=\"\"\n\nSERVER_HOST=xxx.domain.com\nSERVER_PORT=4000\n\n# SSL/TLS Configuration\nSERVER_SSL_ENABLED=false\nSERVER_SSL_CERT=/absolute/path/to/file.crt\nSERVER_SSL_KEY=/absolute/path/to/file.key\n\n# Enable if behind a proxy like NGINX or Haproxy\nTRUST_PROXY=false\n\n# Automatically forward pino (logger) logs to LOKI_URL\nSELF_MONITORING=false\n```\n\n### Let's go baby 🔥\n\n```bash\n$ npm start\n```\n\n## Env\n\nHere is the full Zod schema for envs:\n\n```js\nconst envSchema = z.object({\n  GRAFANA_URL: z.string().url().trim(),\n  LOKI_URL: z.string().url().trim(),\n  TOKEN_CACHE_MS: z.coerce.number().optional().default(1_000 * 60 * 5),\n  SERVER_PORT: z.coerce.number().optional().default(0),\n  SERVER_HOST: z.string().optional(),\n  SERVER_SSL_ENABLED: zBoolean(\"false\"),\n  SERVER_SSL_CERT: z.string().optional(),\n  SERVER_SSL_KEY: z.string().optional(),\n  SERVER_SSL_CA: z.string().optional(),\n  TRUST_PROXY: zBoolean(\"false\"),\n  SELF_MONITORING: zBoolean(\"false\")\n});\n```\n\nWhere zBoolean is defined as\n```ts\nfunction zBoolean(defaultValue?: \"false\" | \"true\") {\n  const zEnum = z.enum([\"true\", \"false\"]).transform((value) =\u003e value === \"true\");\n\n  return defaultValue ? zEnum.optional().default(defaultValue) : zEnum;\n}\n```\n\n## API\n\n### /health\n\nReturn proxy uptime\n\n```json\n{\n  \"uptime\": 10\n}\n```\n\n## Roadmap\n\n- Find a way to also proxy Grafana API (currently that's not possible with the same root prefix).\n\n## Contributors ✨\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/fraxken\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4438263?v=4?s=100\" width=\"100px;\" alt=\"Thomas.G\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eThomas.G\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/MyUnisoft/loki-reverse-proxy/commits?author=fraxken\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/MyUnisoft/loki-reverse-proxy/issues?q=author%3Afraxken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"#security-fraxken\" title=\"Security\"\u003e🛡️\u003c/a\u003e \u003ca href=\"https://github.com/MyUnisoft/loki-reverse-proxy/commits?author=fraxken\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/PierreDemailly\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/39910767?v=4?s=100\" width=\"100px;\" alt=\"PierreDemailly\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePierreDemailly\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/MyUnisoft/loki-reverse-proxy/pulls?q=is%3Apr+reviewed-by%3APierreDemailly\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyunisoft%2Floki-reverse-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyunisoft%2Floki-reverse-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyunisoft%2Floki-reverse-proxy/lists"}