{"id":18900974,"url":"https://github.com/misterowlpt/traefik-auth-api","last_synced_at":"2026-03-02T21:30:18.176Z","repository":{"id":134720595,"uuid":"608698399","full_name":"MisterOwlPT/traefik-auth-api","owner":"MisterOwlPT","description":"A sample project that uses Traefik to control access to a federated REST API","archived":false,"fork":false,"pushed_at":"2023-03-03T10:11:39.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T09:43:37.761Z","etag":null,"topics":["cors","restful-api","traefik"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/MisterOwlPT.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":"2023-03-02T14:59:07.000Z","updated_at":"2023-03-03T10:45:54.000Z","dependencies_parsed_at":"2023-04-28T21:48:18.943Z","dependency_job_id":null,"html_url":"https://github.com/MisterOwlPT/traefik-auth-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterOwlPT%2Ftraefik-auth-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterOwlPT%2Ftraefik-auth-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterOwlPT%2Ftraefik-auth-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterOwlPT%2Ftraefik-auth-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MisterOwlPT","download_url":"https://codeload.github.com/MisterOwlPT/traefik-auth-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239881487,"owners_count":19712597,"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":["cors","restful-api","traefik"],"created_at":"2024-11-08T08:53:33.802Z","updated_at":"2026-03-02T21:30:18.117Z","avatar_url":"https://github.com/MisterOwlPT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traefik + CORS + Authenticated REST API \n\n**This project was created as a case study only!**\n\nThis project shows how you can configure [Traefik](https://doc.traefik.io/traefik/) to control access to a federated REST API so that:\n- All requests to the API are forwarded to a custom authentication service;\n- Only requests authenticated with success are granted access to the REST API. A response to the request is then provided by the API service;\n- All requests with insufficient permissions are blocked. In this case responses are provided by the authentication service itself; \n- CORS requests are handled properly in both situations.\n\n## Quick start\n\nBuild all required Docker images and launch containers:\n\n```bash\n$ docker compose up -d\n```\n\nTo inspect incoming authentication requests check the authentication server logs:\n\n```bash\n$ docker compose logs -tf auth\n```\n\nAccess the web application (http://frontend.localhost).\n\n## Expected behaviour \n\nClick on the `Make authenticated request` button:\n- Check the browser's console and a message should appear: `I am making an authenticated request (authenticated = true)`;\n- The authentication server should print a new log message: `Received authentication request with permissions set to 'true'`;\n- A pop-up alert should appear on your browser window displaying the message: `Hello from backend server!`;\n- Check the browser's console and no error should appear.\n\nClick on the `Make unauthenticated request` button:\n- Check the browser's console and a message should appear: `I am making an unauthenticated request (authenticated = false)`;\n- The authentication server should print a new log message: `Received authentication request with permissions set to 'false'`;\n- No pop-up alert should appear on your browser window;\n- Check the browser's console and an error (non CORS-related) should appear: `GET http://backend.localhost/ 401 (Unauthorized)`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisterowlpt%2Ftraefik-auth-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmisterowlpt%2Ftraefik-auth-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisterowlpt%2Ftraefik-auth-api/lists"}