{"id":18926822,"url":"https://github.com/ladjs/express-redirect-loop","last_synced_at":"2026-01-08T09:49:20.133Z","repository":{"id":42373029,"uuid":"119513395","full_name":"ladjs/express-redirect-loop","owner":"ladjs","description":"Prevent redirect loops with sessions since HTTP referrer header is unreliable","archived":false,"fork":false,"pushed_at":"2022-04-08T08:03:32.000Z","size":505,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-24T20:30:04.628Z","etag":null,"topics":["301","302","endless","express","fix","loop","recursive","redirect","redirection"],"latest_commit_sha":null,"homepage":"https://lad.js.org","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/ladjs.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}},"created_at":"2018-01-30T09:28:01.000Z","updated_at":"2022-03-17T17:48:16.000Z","dependencies_parsed_at":"2022-08-28T21:21:49.233Z","dependency_job_id":null,"html_url":"https://github.com/ladjs/express-redirect-loop","commit_stats":null,"previous_names":["niftylettuce/express-redirect-loop"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fexpress-redirect-loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fexpress-redirect-loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fexpress-redirect-loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fexpress-redirect-loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/express-redirect-loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246652110,"owners_count":20812088,"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":["301","302","endless","express","fix","loop","recursive","redirect","redirection"],"created_at":"2024-11-08T11:17:16.269Z","updated_at":"2026-01-08T09:49:20.109Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","readme":"# express-redirect-loop\n\n[![build status](https://img.shields.io/travis/niftylettuce/express-redirect-loop.svg)](https://travis-ci.org/niftylettuce/express-redirect-loop)\n[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/express-redirect-loop.svg)](https://codecov.io/gh/niftylettuce/express-redirect-loop)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/niftylettuce/express-redirect-loop.svg)](LICENSE)\n\n\u003e Prevent redirect loops with sessions since HTTP referrer header is unreliable\n\n\n## Table of Contents\n\n* [Install](#install)\n* [Usage](#usage)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n[npm][]:\n\n```sh\nnpm install express-redirect-loop\n```\n\n[yarn][]:\n\n```sh\nyarn add express-redirect-loop\n```\n\n\n## Usage\n\n```js\nconst express = require('express');\nconst session = require('express-session');\nconst redirectLoop = require('express-redirect-loop');\n\nconst app = express();\n\napp.use(\n  session({\n    secret: 'test',\n    resave: false,\n    saveUninitialized: true\n  })\n);\n\napp.use(redirectLoop({\n  defaultPath: '/',\n  maxRedirects: 5\n}));\n\napp.get('/', (req, res) =\u003e res.sendStatus(200));\napp.get('/bar', (req, res) =\u003e res.redirect('/foo'));\napp.get('/foo', (req, res) =\u003e res.redirect('/foo'));\napp.get('/baz', (req, res) =\u003e res.redirect('/bar'));\n\napp.listen(3000);\n```\n\n\n## Contributors\n\n| Name           | Website                    |\n| -------------- | -------------------------- |\n| **Nick Baugh** | \u003chttp://niftylettuce.com/\u003e |\n\n\n## License\n\n[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)\n\n\n## \n\n[npm]: https://www.npmjs.com/\n\n[yarn]: https://yarnpkg.com/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fexpress-redirect-loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fexpress-redirect-loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fexpress-redirect-loop/lists"}