{"id":30112541,"url":"https://github.com/codesandbox/example-custom-preview-proxy","last_synced_at":"2026-02-10T16:11:31.765Z","repository":{"id":309112686,"uuid":"1031795742","full_name":"codesandbox/example-custom-preview-proxy","owner":"codesandbox","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-04T10:46:29.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T23:54:58.961Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/codesandbox.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,"zenodo":null}},"created_at":"2025-08-04T10:46:08.000Z","updated_at":"2025-08-04T20:37:59.000Z","dependencies_parsed_at":"2025-08-09T23:55:01.063Z","dependency_job_id":"d52e737f-2454-41fd-8f26-143820008c04","html_url":"https://github.com/codesandbox/example-custom-preview-proxy","commit_stats":null,"previous_names":["codesandbox/example-custom-preview-proxy"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/codesandbox/example-custom-preview-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesandbox%2Fexample-custom-preview-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesandbox%2Fexample-custom-preview-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesandbox%2Fexample-custom-preview-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesandbox%2Fexample-custom-preview-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codesandbox","download_url":"https://codeload.github.com/codesandbox/example-custom-preview-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesandbox%2Fexample-custom-preview-proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269688023,"owners_count":24459399,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-08-10T06:47:27.539Z","updated_at":"2026-02-10T16:11:31.724Z","avatar_url":"https://github.com/codesandbox.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom reverse proxy for *.csb.app domains\n\nThis repo uses nginx server to route all `*.test.com` requests to `*.csb.app`. This is used in this repo to show a custom 502 page when the csb.app preview urls return 502.\n\n## Notes\n- The proxy adds `csb_is_trusted=true` to trust the request coming in from the domain\n- If all routes are requested via this proxy, there could some added latency as the request has to hop through one extra layer\n\n## Running locally\n\nBuild docker image\n```sh\ndocker build -t nginx-proxy .\n```\n\nRun the container\n```sh\ndocker run -p 8123:80 nginx-proxy\n```\n\nMake a curl request to simulate `*.test.com` and see the response from the csb.app domain\nFor this example we can use https://codesandbox.io/p/devbox/9cgchy as the sandbox.\n\n```sh\ncurl localhost:8123 -H \"Host: 9cgchy-8080.test.com\"\nHello from CodeSandbox!%\n```\n\nThis should return the response from `9cgchy-8080.csb.app`.\n\nNow we can test the 502 by stopping the running dev server inside the sandbox. \n\nNow it will return the custom 502 page\n```sh\ncurl localhost:8123 -H \"Host: 9cgchy-8080.test.com\"\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003eError\u003c/title\u003e\n    \u003cstyle\u003e\n        body { font-family: Arial, sans-serif; text-align: center; margin-top: 100px; }\n        h1 { color: #e74c3c; }\n        p { color: #7f8c8d; }\n    \u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003eError\u003c/h1\u003e\n    \u003cp\u003eThe server cannot be reached. Start the dev server inside the vm\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e%      \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesandbox%2Fexample-custom-preview-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesandbox%2Fexample-custom-preview-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesandbox%2Fexample-custom-preview-proxy/lists"}