{"id":16215600,"url":"https://github.com/njgibbon/nicks-cors-test","last_synced_at":"2025-03-16T11:30:56.481Z","repository":{"id":62410633,"uuid":"182254912","full_name":"njgibbon/nicks-cors-test","owner":"njgibbon","description":"Simple HTML \u0026 JS Tool to quickly test CORS locally.","archived":false,"fork":false,"pushed_at":"2021-10-28T00:02:36.000Z","size":6,"stargazers_count":125,"open_issues_count":1,"forks_count":64,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T08:19:31.145Z","etag":null,"topics":["cors","cross-origin-resource-sharing","html","http","https","javascript","jquery","js","tools"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/njgibbon.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}},"created_at":"2019-04-19T11:32:32.000Z","updated_at":"2025-02-25T15:24:47.000Z","dependencies_parsed_at":"2022-11-01T12:46:12.068Z","dependency_job_id":null,"html_url":"https://github.com/njgibbon/nicks-cors-test","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/njgibbon%2Fnicks-cors-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njgibbon%2Fnicks-cors-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njgibbon%2Fnicks-cors-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njgibbon%2Fnicks-cors-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/njgibbon","download_url":"https://codeload.github.com/njgibbon/nicks-cors-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814864,"owners_count":20352037,"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","cross-origin-resource-sharing","html","http","https","javascript","jquery","js","tools"],"created_at":"2024-10-10T11:15:28.058Z","updated_at":"2025-03-16T11:30:55.726Z","avatar_url":"https://github.com/njgibbon.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nicks-cors-test\nSimple HTML \u0026 JS Tool to quickly test CORS locally.\n\n\n# Blog\nhttps://medium.com/pareture/simple-local-cors-test-tool-544f108311c5\n\n\n# CORS\nCross Origin Resource Sharing (CORS) is a simple and powerful mechanism which uses HTTP headers so that a server knows where a request is coming from and can choose whether or not to accept the request based on this.\n\nBetter information here:\nhttps://developer.mozilla.org/en-US/docs/Web/HTTP/CORS\n\nThe header which is provided as the argument is the ‘Origin’. This is set by the User-Agent (the thing that makes the request) and can not be overridden (security enforced).\n\nThe server with the resource uses the `Access-Control-Allow-Origin` header to allowlist particular domains or allow requests from all origins using the wildcard:\n```\nAccess-Control-Allow-Origin: *\n```\n\n\n# Tool\nYou can use this simple tool to test making CORS requests and examine the outcome.\n\n* The HTML file is simply a shell to call the Javascript function.\n* The JS file executes an AJAX request based on the values you adjust.\n\n\n# Guide\n* Download the files and open `index.html` in a browser. You will be faced with a blank screen and nothing else.\n* Open the browser tools: e.g **Right-click** \u003e **Inspect** \u003e **Console**.\n* Open `main.js` file in a text editor.\n* Adjust the `url` value depending on the resource you want to check, save `main.js` and refresh the browser. \n    * Try `https://google.com` and you will see it has been blocked due to CORS.\n    * Try `https://api.github.com` and you will see it is not blocked and the content will be output.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjgibbon%2Fnicks-cors-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnjgibbon%2Fnicks-cors-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjgibbon%2Fnicks-cors-test/lists"}