{"id":22678734,"url":"https://github.com/halo-sigs/plugin-trailing-slash","last_synced_at":"2025-06-12T14:07:41.945Z","repository":{"id":238786675,"uuid":"797537833","full_name":"halo-sigs/plugin-trailing-slash","owner":"halo-sigs","description":"重写请求去除尾部斜杠，以保证 URL 规范化, 例如: /path/ -\u003e /path","archived":false,"fork":false,"pushed_at":"2024-05-08T05:51:31.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T14:07:30.265Z","etag":null,"topics":["blog","blog-engine","cms","halo","plugin","sitebuilder"],"latest_commit_sha":null,"homepage":"https://www.halo.run/store/apps/app-KOQzV","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halo-sigs.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,"zenodo":null}},"created_at":"2024-05-08T03:15:17.000Z","updated_at":"2024-05-11T03:23:07.000Z","dependencies_parsed_at":"2024-05-11T20:31:28.130Z","dependency_job_id":null,"html_url":"https://github.com/halo-sigs/plugin-trailing-slash","commit_stats":null,"previous_names":["halo-sigs/plugin-trailing-slash"],"tags_count":1,"template":false,"template_full_name":"halo-dev/plugin-starter","purl":"pkg:github/halo-sigs/plugin-trailing-slash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halo-sigs%2Fplugin-trailing-slash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halo-sigs%2Fplugin-trailing-slash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halo-sigs%2Fplugin-trailing-slash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halo-sigs%2Fplugin-trailing-slash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halo-sigs","download_url":"https://codeload.github.com/halo-sigs/plugin-trailing-slash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halo-sigs%2Fplugin-trailing-slash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259479594,"owners_count":22864362,"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":["blog","blog-engine","cms","halo","plugin","sitebuilder"],"created_at":"2024-12-09T18:17:17.180Z","updated_at":"2025-06-12T14:07:41.920Z","avatar_url":"https://github.com/halo-sigs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" style=\"text-align: center\"\u003e\n    \u003cimg alt=\"logo\" width=\"96px\" src=\"src/main/resources/logo.svg\" style=\"border-radius: 15px\"\u003e\n    \u003ch1\u003eTrailing Slash\u003c/h1\u003e\n    \u003cp\u003e重写请求去除尾部斜杠，以保证 URL 规范化, 例如: /path/ -\u003e /path\u003c/p\u003e\n    \u003cp align=\"center\" style=\"text-align: center\"\u003e\n        \u003ca href=\"https://www.halo.run/store/apps/app-KOQzV?tab=readme\"\u003e\u003cimg alt=\"Halo App Store\" src=\"https://img.shields.io/badge/Halo-%E5%BA%94%E7%94%A8%E5%B8%82%E5%9C%BA-%230A81F5?style=flat-square\u0026logo=appstore\u0026logoColor=%23fff\" /\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/halo-sigs/plugin-trailing-slash/releases\"\u003e\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/halo-sigs/plugin-trailing-slash?style=flat-square\u0026logo=github\" /\u003e\u003c/a\u003e\n        \u003ca href=\"https://github.com/halo-sigs/plugin-trailing-slash/actions/workflows/ci.yaml\"\u003e\u003cimg alt=\"GitHub Actions Workflow Status\" src=\"https://img.shields.io/github/actions/workflow/status/halo-sigs/plugin-trailing-slash/ci.yaml?style=flat-square\u0026label=build\" /\u003e\u003c/a\u003e\n        \u003ca href=\"./LICENSE\"\u003e\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/halo-sigs/plugin-trailing-slash?style=flat-square\" /\u003e\u003c/a\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n## 简介\n\n`Trailing Slash` 插件用于处理请求 URL 尾部斜杠问题。在 Spring Framework 3.0\n及以上版本中，[尾部斜杠的路由支持被弃用](https://github.com/spring-projects/spring-framework/issues/28552)\n，可能导致一些低版本 Halo 或者从其他应用如 Wordpress 等迁移过来的数据的请求路径无法正确处理。该插件旨在通过重写请求路径，移除\nURL 尾部的斜杠，使其能够被正确匹配和处理。\n\n## 问题背景\n\n在 Spring Framework 3.0 之前，框架对 URL 尾部斜杠的路由进行了较宽松的处理。如果一个路由定义为 `/example`，访问 `/example/`\n也能成功匹配并返回结果。然而，从 Spring Framework 3.0 开始，为了提高路由规则的一致性和准确性，框架不再支持尾部斜杠的自动匹配行为。\n这导致一些依赖尾部斜杠的用户在升级到 Halo 2.x 后出现 404 错误。\n\n## 插件解决方案\n\n`Trailing Slash` 插件通过拦截请求 URL，并移除尾部的斜杠，使请求能够与定义的路由匹配。它适用于以下场景：\n\n- **兼容性**：保持旧版本 Halo 在升级到 Halo 2.x 或者从其他应用迁移到 Halo 2.x 后仍然能够处理带尾部斜杠的请求。\n- **一致性**：统一路由风格，使所有路由都保持一致的 URL 结构。\n\n### 插件功能\n\n- **尾部斜杠处理**：自动移除请求 URL 中的尾部斜杠\n- **主题端过滤**：作为主题端 WebFilter 适用于所有主题端请求路径(`/apis`,`/api` 开头的请求除外)\n\n## 使用建议\n\n尽管该插件可以帮助解决尾部斜杠问题，但从长期来看，不建议在生产环境中依赖尾部斜杠路由。\n为了获得更好的兼容性和可维护性，建议逐步过渡到标准化的无尾部斜杠路由风格。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalo-sigs%2Fplugin-trailing-slash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalo-sigs%2Fplugin-trailing-slash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalo-sigs%2Fplugin-trailing-slash/lists"}