{"id":29189417,"url":"https://github.com/coderaiser/node-proxy-user","last_synced_at":"2025-07-01T23:07:40.494Z","repository":{"id":65476774,"uuid":"51384737","full_name":"coderaiser/node-proxy-user","owner":"coderaiser","description":"proxy requests according to username","archived":false,"fork":false,"pushed_at":"2018-11-15T13:22:11.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-17T21:46:54.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/coderaiser.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-09T17:36:28.000Z","updated_at":"2018-11-15T13:22:13.000Z","dependencies_parsed_at":"2023-01-25T06:25:14.422Z","dependency_job_id":null,"html_url":"https://github.com/coderaiser/node-proxy-user","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/coderaiser/node-proxy-user","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fnode-proxy-user","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fnode-proxy-user/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fnode-proxy-user/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fnode-proxy-user/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderaiser","download_url":"https://codeload.github.com/coderaiser/node-proxy-user/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fnode-proxy-user/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260471627,"owners_count":23014254,"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":[],"created_at":"2025-07-01T23:07:39.749Z","updated_at":"2025-07-01T23:07:40.417Z","avatar_url":"https://github.com/coderaiser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proxy-user\n\nProxy requests according to username.\n\n## Install\n\n`npm i proxy-user --save`\n\n## API\n\n```js\nconst proxyUser = require('proxy-user');\n```\n\n### proxyUser.web(options)\nProxy http requests.\n`options` could contain:\n- `logout` function on `/[username]/logout`\n- `port` to redirect to\n- `user` data (`username`, `password`)\n- `target` url to redirect to\n\n```js\nproxyUser.web({\n    logout: req =\u003e console.log('logout'),\n    port: 80,           // default\n    target: 'localhost',// default\n    user: {\n        username: 'coderaiser',\n        password: 'hello'\n    }\n});\n```\n\n### proxyUser.web(options)\nProxy socket requests.\n`options` could contain:\n- `port` to redirect to\n- `user` data (`username`, `password`)\n- `target` url to redirect to\n\n```js\nproxy.socket({\n    port: 80            // default\n    target: 'localhost',// default\n})\n```\n\n## Example\n`proxy-user` could be used as [express](http://expressjs.com) middleware.\n\n```js\nconst http = require('http');\nconst app = require('express')();\nconst server = http.createServer(app);\n\nconst PORT = 31337;\n\nconst socket = proxy.socket()\n    .on('error', (error) =\u003e {\n        console.error(error.message);\n    })\n\nserver.on('upgrade', socket);\n\napp.use(proxyUser.web({\n    username: 'coderaiser',\n    password: 'hello'\n});\n\nserver.listen(PORT, () =\u003e {\n    console.log('url: http://%s:%d', 'localhost', PORT);\n});\n```\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fnode-proxy-user","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderaiser%2Fnode-proxy-user","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fnode-proxy-user/lists"}