{"id":15764207,"url":"https://github.com/devjiwonchoi/set-status","last_synced_at":"2026-05-16T11:32:50.173Z","repository":{"id":214820524,"uuid":"737439772","full_name":"devjiwonchoi/set-status","owner":"devjiwonchoi","description":"Set a custom HTTP status code for the client by utilizing proxy and a meta tag.","archived":false,"fork":false,"pushed_at":"2023-12-31T17:28:13.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T18:26:47.288Z","etag":null,"topics":["browser","client","next","nextjs","proxy","status","status-code"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/devjiwonchoi.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-12-31T03:19:30.000Z","updated_at":"2024-02-06T23:49:01.000Z","dependencies_parsed_at":"2024-10-25T11:35:25.695Z","dependency_job_id":"55929420-5a88-4a0e-a04d-8f4bb9ce84d2","html_url":"https://github.com/devjiwonchoi/set-status","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"68a0636a5ec7d7585b09ff1ab1b50bfd27c441c4"},"previous_names":["devjiwonchoi/next-status","devjiwonchoi/set-status"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devjiwonchoi/set-status","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjiwonchoi%2Fset-status","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjiwonchoi%2Fset-status/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjiwonchoi%2Fset-status/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjiwonchoi%2Fset-status/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devjiwonchoi","download_url":"https://codeload.github.com/devjiwonchoi/set-status/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjiwonchoi%2Fset-status/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33100848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["browser","client","next","nextjs","proxy","status","status-code"],"created_at":"2024-10-04T12:01:56.952Z","updated_at":"2026-05-16T11:32:50.129Z","avatar_url":"https://github.com/devjiwonchoi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# set-status\n\n\u003e Set a custom HTTP status code for the client by utilizing proxy and a meta tag.\n\n**Note: Manipulating HTTP status code is not recommended for production. Use at your own risk.**\n\nCurrent v0 is inspired by [next-status-proxy](https://github.com/suleymangezsat/next-status-proxy).\n\n## Install\n\n```sh\npnpm add set-status\n```\n\n## Configuration\n\nYou can configure all settings with the environment variables.\n\n- Set the `TARGET_URL` as your target app URL, `http://localhost:3000` by default.\n- Set the `PROXY_SERVER_PORT` for the proxy server port, `3001` by default.\n- Set the `TARGET_META_NAME` for the target `meta` tag, `set-status` by default.\n- Set the `IGNORE_PATH_REGEX` for the regex to ignore the target path set to Next.js by default.\n\n\u003e See [`.env.example`](./.env.example) for an example.\n\n## Usage\n\n### Basic\n\nRun the proxy server with the following command:\n\n```sh\npnpm proxy-status\n```\n\nThe proxy server will look for the target meta tag and set the status code to the client.\n\n```html\n\u003cmeta name=\"set-status\" content=\"401\" /\u003e\n```\n\nThe meta tag above will let the proxy server set the status code to `401`.\n\n### Recommended\n\nInstall [`concurrently`](https://www.npmjs.com/package/concurrently) to run the proxy server and your production app concurrently.\n\n```sh\npnpm add concurrently\n```\n\nSet your `start` script in `package.json` as follows:\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"concurrently \\\"pnpm proxy-status\\\" \\\"YOUR PRODUCTION COMMAND\\\"\"\n  }\n}\n```\n\n```sh\npnpm start\n```\n\n### Next.js\n\n\u003e See examples in [`examples/nextjs`](./examples/nextjs).\n\nIn Next.js, you can statically set a custom `meta` tag by using a `Metadata` API.\n\nThrough this, we can set the status code read from the target meta tag.\n\n```tsx\n// page.tsx\n\nexport default function Unauthorized() {\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003e401\u003c/h1\u003e\n      \u003cp\u003eUnauthorized\u003c/p\u003e\n    \u003c/div\u003e\n  )\n}\n\nexport const metadata = {\n  other: {\n    'set-status': 401,\n  },\n}\n```\n\nAlso, you can dynamically set the target meta tag by using `generateMetadata` function.\n\n```tsx\n// page.tsx\n\nexport async function generateMetadata() {\n  const res = await fetch('https://example.com/api')\n  \n  if (res.status !== 200) {\n    return {\n      other: {\n        'set-status': res.status,\n      },\n    }\n  }\n}\n```\n\nFor more information about the `Metadata` API, see the [Next.js documentation](https://nextjs.org/docs/app/building-your-application/optimizing/metadata).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjiwonchoi%2Fset-status","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevjiwonchoi%2Fset-status","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjiwonchoi%2Fset-status/lists"}