{"id":24383443,"url":"https://github.com/firstandthird/hapi-trailing-slash","last_synced_at":"2026-04-07T05:31:51.588Z","repository":{"id":48017336,"uuid":"54147442","full_name":"firstandthird/hapi-trailing-slash","owner":"firstandthird","description":"Hapi plugin to redirect to non-trailing slash urls","archived":false,"fork":false,"pushed_at":"2021-08-11T00:05:10.000Z","size":199,"stargazers_count":2,"open_issues_count":6,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-20T04:37:09.921Z","etag":null,"topics":["hapi-plugin","hapi-v17"],"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/firstandthird.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-03-17T19:57:49.000Z","updated_at":"2021-03-17T18:29:43.000Z","dependencies_parsed_at":"2022-08-12T16:41:17.362Z","dependency_job_id":null,"html_url":"https://github.com/firstandthird/hapi-trailing-slash","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/firstandthird/hapi-trailing-slash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-trailing-slash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-trailing-slash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-trailing-slash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-trailing-slash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstandthird","download_url":"https://codeload.github.com/firstandthird/hapi-trailing-slash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-trailing-slash/sbom","scorecard":{"id":401100,"data":{"date":"2025-08-11","repo":{"name":"github.com/firstandthird/hapi-trailing-slash","commit":"40f3c5d92083f8fa4b8a443ec1aa86e93cf41f99"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/16 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"37 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-mg85-8mv5-ffjr","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-7hx8-2rxv-66xv","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-2mvq-xp48-4c77","Warn: Project is vulnerable to: GHSA-5854-jvxx-2cg9","Warn: Project is vulnerable to: GHSA-g64q-3vg8-8f93","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-mgfv-m47x-4wqp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T20:06:59.666Z","repository_id":48017336,"created_at":"2025-08-18T20:06:59.666Z","updated_at":"2025-08-18T20:06:59.666Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31501903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"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":["hapi-plugin","hapi-v17"],"created_at":"2025-01-19T10:14:29.790Z","updated_at":"2026-04-07T05:31:51.568Z","avatar_url":"https://github.com/firstandthird.png","language":"JavaScript","readme":"# hapi-trailing-slash # [![Build Status](https://travis-ci.org/firstandthird/hapi-trailing-slash.svg?branch=master)](https://travis-ci.org/firstandthird/hapi-trailing-slash)\n\nA [hapi](https://hapi.dev/) plugin that handles common trailing slash issues for incoming URLs,\nso that _my-route_ and _my-route/_ will have consistent behaviors.\n\n## Installation\n\n```\nnpm install hapi-trailing-slash\n```\n\n## Basic Use\n\nThis plugin will register a preResponse extension that checks the path of all 404 Not Found results  before they are returned to the client. Depending on the behavior you've requested, it will either add or remove a trailing '/' to the request as needed and then return either a permanent or temporary [HTTP Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301) response containing the address of the new route.    \n\n- __remove__ behavior:\n\n  ```javascript\n  const module = require(\"hapi-trailing-slash\");\n  await server.register({\n    plugin: module,\n    options: {\n      method: 'remove'\n    }\n  });\n  server.route({\n    method: 'GET',\n    path: '/test',\n    handler: function (request, h) {\n      return 'ok';\n    }\n  });\n  ```\n\n  Since this specifies the 'remove' behavior, if you try to GET _/test/_ (which contains an extra trailing slash and thus does not match the route path), hapi-trailing-slash will intercept the 404 before it is returned.  It will instead return an HTTP Redirect response with the Location header set to _/test_.  And you can still GET _/test_ directly and the plugin will not interfere.\n\n- __append__ behavior:\n\n  _append_ does the exact opposite of _remove_:\n\n    ```javascript\n    const module = require(\"hapi-trailing-slash\");\n    await server.register({\n      plugin: module,\n      options: {\n        method: 'append'\n      }\n    });\n    server.route({\n      method: 'GET',\n      path: '/test/',\n      handler: function (request, h) {\n        return 'ok';\n      }\n    });\n    ```\n\n    Now if you try to GET _/test_ (which does not match the route path), hapi-trailing-slash will intercept the call before the 404 Not Found error is returned to the client.  It then adds a trailing slash and instead returns an HTTP Redirect with the Location set to _/test/_.   But GET _/test/_ will still work as normal and you'll get the expected 'ok' response.\n\n\nYou must specify either 'append' or 'remove' when you register the plugin.  All other plugin options are optional.  \n\n## Other Options\n\n- __checkIfExists__\n\n  By default hapi-trailing-slash will not check if your new route exists before automatically returning a redirect to it.  But if you set _checkIfExists_ to true, then the plugin will do a quick [HTTP HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) check to see if the new route actually exists.  If it does not get a response, then it will go ahead and just return the original 404 Not Found result instead of a Redirect.\n\n   _checkIfExists_ saves your clients from executing a request to a non-existent Location, instead it just tells them that the route does not exist.   \n\n- __statusCode__\n\n  By default hapi-trailing-slash returns all redirects with a [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301) status code.  But you can use this option to specify that you want it to instead use the [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) status code (for temporary redirects) when you register the plugin.\n\n- __verbose__\n\n  Set this to _true_ to have hapi-trailing-slash post a server log of all redirects that it executes. This will include info like the user agent, browser, and from/to request paths.  Default is false.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-trailing-slash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstandthird%2Fhapi-trailing-slash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-trailing-slash/lists"}