{"id":16302996,"url":"https://github.com/himenon/oauth2_proxy","last_synced_at":"2025-04-10T05:58:37.019Z","repository":{"id":107741620,"uuid":"121018316","full_name":"Himenon/oauth2_proxy","owner":"Himenon","description":"Multiple Reverse Proxy Sapmle with oauth2_proxy","archived":false,"fork":false,"pushed_at":"2020-07-04T06:25:54.000Z","size":48,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T19:35:23.106Z","etag":null,"topics":["nginx","oauth2","reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":"Smarty","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/Himenon.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":"2018-02-10T13:37:10.000Z","updated_at":"2022-12-12T08:40:39.000Z","dependencies_parsed_at":"2023-06-08T22:36:24.018Z","dependency_job_id":null,"html_url":"https://github.com/Himenon/oauth2_proxy","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/Himenon%2Foauth2_proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Foauth2_proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Foauth2_proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Foauth2_proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Himenon","download_url":"https://codeload.github.com/Himenon/oauth2_proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166948,"owners_count":21058480,"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":["nginx","oauth2","reverse-proxy"],"created_at":"2024-10-10T20:59:26.412Z","updated_at":"2025-04-10T05:58:37.000Z","avatar_url":"https://github.com/Himenon.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multiple Reverse Proxy Sapmle with oauth2_proxy\n\n[oauth2_proxy](https://github.com/bitly/oauth2_proxy)を用いて、\n複数のリバースプロキシ先をOAuth2で認証させるサンプルです。\n\n## Architecture\n\n![reverse proxy architecture including oauth2_proxy](./assets/images/reverse-proxy-architecture-including-oauth2_proxy.png)\n\n## Usage\n\n### Local\n\n**準備**\n\nリバースプロキシをする際、サブドメインで行う場合、トップレベルのドメインまで必要なので、ローカルで確認する場合は`/etc/hosts`ファイルを書き換える必要があります。\n\n**その他設定**\n\n1. ProviderからOAuthのClient IDと、Client Secret Keyを取得します。\n2. `docker-compose.yml`の該当箇所に記入します。必要なら`.env`に切り出してください。\n3. `COOKIE_DOMAIN`をサブドメインを含まずに記入します。\n4. `COOKIE_NAME`、`COOKIE_SECRET`、`EMAIL_DOMAIN`はお好きにどうぞ。\n\n**起動**\n\ndocker-composeで立ち上げる場合は下記のコマンドで完了です。\n\n```bash\n$ docker-compose up\n```\n\n**アクセス**\n\n自分で設定したURLにアクセスして下さい。\n\n#### 注意\n\n**CSRFエラーが出る場合**\n\n```\n403 Permission Denied\ncsrf failed\n```\n\n_発生条件_\n\n`COOKIE_DOMAIN`を`a.localhost.com`などとして、`a.localhost.com`にアクセスした後、`b.localhost.com`にアクセスした場合に生じます。\n\n_原因_\n\nCookieが`a.localhost.com`にキャッシュされているにも関わらず、`b.localhost.com`で利用しようとしたためです。\nコンソール上に`oauth2_proxy`がエラーログを吐き出します。\n\n_解決策_\n\n1. `COOKIE_DOMAIN`にサブドメインを含めずに記述する。\n2. ブラウザのCookieを削除する。ホスト単位で削除する方法は各ブラウザの仕様を確認して下さい。\n\n# TODO\n\n- [x] 動くように\n- [ ] Readmeの充実化\n- [ ] Redirect URIを1つだけにできるかどうか確認する\n    - 参考: https://github.com/bitly/oauth2_proxy/issues/237\n\n# Made by\n\n- 画像の作成 [draw.io](https://draw.io)\n\n# Reference\n\nNote: 新しい順\n\n- 2017/12/14 [手っ取り早くウェブアプリケーションにOAuth2認証を導入する](http://moznion.hatenadiary.com/entry/2017/12/14/230945)\n- 2017/04/05 [oauth2_proxyでRundeckにGitHub認証でログインする](https://qiita.com/minamijoyo/items/52041ff8628263355810)\n- 2016/01/18 [oauth2_proxyとNginxのauth_requestを組み合わせると便利](http://lamanotrama.hateblo.jp/entry/2016/01/18/142116)\n- [a5huynh/oauth2_proxy](https://github.com/a5huynh/oauth2_proxy)\n\n# Author\n\n- [Himenon](https://github.com/Himenon)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimenon%2Foauth2_proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhimenon%2Foauth2_proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimenon%2Foauth2_proxy/lists"}