{"id":21180163,"url":"https://github.com/hypnoce/nginx-cors","last_synced_at":"2026-05-20T03:35:59.829Z","repository":{"id":95050222,"uuid":"149878659","full_name":"hypnoce/nginx-cors","owner":"hypnoce","description":"Simple nginx allowing cors","archived":false,"fork":false,"pushed_at":"2018-12-19T18:41:28.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-21T12:08:49.699Z","etag":null,"topics":["cors","cors-proxy","docker","nginx"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/hypnoce.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":"2018-09-22T13:19:28.000Z","updated_at":"2020-07-18T03:59:43.000Z","dependencies_parsed_at":"2023-06-11T19:30:08.394Z","dependency_job_id":null,"html_url":"https://github.com/hypnoce/nginx-cors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypnoce%2Fnginx-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypnoce%2Fnginx-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypnoce%2Fnginx-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypnoce%2Fnginx-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypnoce","download_url":"https://codeload.github.com/hypnoce/nginx-cors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243632408,"owners_count":20322382,"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","cors-proxy","docker","nginx"],"created_at":"2024-11-20T17:36:46.608Z","updated_at":"2026-05-20T03:35:54.787Z","avatar_url":"https://github.com/hypnoce.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nginx-cors\nDockerized NGINX web server allowing Cross Origin Resource Sharing ([CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing))\n\n## Problem\nHave you loaded your web app from one location and are trying to request resources from another origin?\nIf that origin does not respond appropriately to the browser's preflight OPTIONS request, then your browser will block the call.\nYou could fix this issue by having those services respond correctly - but what if you do not own them?\nWhat if you only want to activate them in development without adding additional code?\n\n## Solution\nIn order to work around this we have configured an NGINX server to intercept all OPTIONS calls and return the appropriate response allowing CORS from all origins.\nReverse proxying your service through this NGINX should solve your issue.\nYou could also place this NGINX in a Traefik set up and route all OPTIONS requests to it therefore only requiring one instance for all your services.\n\n\n## Implementation\n\nWe pull the light Alpine based docker image of NGINX and decorate it with CORS configuration.\n\n## How to use it\nClone this repo and `cd` into it.   \n`docker build . -t nginx-cors` to create the image.  \n`docker run -d -p 8080:8080 nginx-cors` to run it exposing the `8080` port on the host.  \nOf course you could also run this in your k8s cluster.  \n\nThe running instance on its own with our configuration is not of great use - you will have to either enrich the configuration with your services in order to reverse proxy them through NGINX or your could drop it along side them in a Traefik instance.\n\n##### TODO:  \n[ ] Explain how this would be configured in Traefik  \n[ ] Explain how this would run in K8s  \n\nEnjoy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypnoce%2Fnginx-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypnoce%2Fnginx-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypnoce%2Fnginx-cors/lists"}