{"id":20037977,"url":"https://github.com/perfectlysoft/perfect-webredirects","last_synced_at":"2025-07-01T11:09:06.476Z","repository":{"id":63920187,"uuid":"81024591","full_name":"PerfectlySoft/Perfect-WebRedirects","owner":"PerfectlySoft","description":"Filter for specified routes (including trailing wildcard routes) and perform redirects as instructed if a match is found.","archived":false,"fork":false,"pushed_at":"2018-02-10T04:08:25.000Z","size":12,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-21T07:46:23.249Z","etag":null,"topics":["http-server","server-side-swift","swift"],"latest_commit_sha":null,"homepage":"https://github.com/PerfectExamples/Perfect-WebRedirects-Demo","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerfectlySoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-05T21:47:20.000Z","updated_at":"2018-07-19T03:23:31.000Z","dependencies_parsed_at":"2023-01-14T14:00:34.117Z","dependency_job_id":null,"html_url":"https://github.com/PerfectlySoft/Perfect-WebRedirects","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/PerfectlySoft/Perfect-WebRedirects","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-WebRedirects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-WebRedirects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-WebRedirects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-WebRedirects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectlySoft","download_url":"https://codeload.github.com/PerfectlySoft/Perfect-WebRedirects/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-WebRedirects/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262950389,"owners_count":23389645,"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":["http-server","server-side-swift","swift"],"created_at":"2024-11-13T10:24:28.571Z","updated_at":"2025-07-01T11:09:06.439Z","avatar_url":"https://github.com/PerfectlySoft.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Perfect Web Redirects\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://perfect.org/get-involved.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.org/assets/github/perfect_github_2_0_0.jpg\" alt=\"Get Involed with Perfect!\" width=\"854\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PerfectlySoft/Perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_1_Star.jpg\" alt=\"Star Perfect On Github\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://stackoverflow.com/questions/tagged/perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/perfect_gh_button_2_SO.jpg\" alt=\"Stack Overflow\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"https://twitter.com/perfectlysoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_3_twit.jpg\" alt=\"Follow Perfect on Twitter\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_4_slack.jpg\" alt=\"Join the Perfect Slack\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat\" alt=\"Swift 4.0\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms OS X | Linux\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.org/licensing.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache-lightgrey.svg?style=flat\" alt=\"License Apache\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://twitter.com/PerfectlySoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Twitter-@PerfectlySoft-blue.svg?style=flat\" alt=\"PerfectlySoft Twitter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.ly/badge.svg\" alt=\"Slack Status\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Perfect Web Redirects Demo\n\nThe Perfect WebRedirects module will filter for specified routes (including trailing wildcard routes) and perform redirects as instructed if a match is found.\n\nA demo showing the usage, and working of the Perfect WebRedirects module can be found at [https://github.com/PerfectExamples/Perfect-WebRedirects-Demo](https://github.com/PerfectExamples/Perfect-WebRedirects-Demo).\n\n## Including in your project\n\nImport the dependency into your project by specifying it in your project's Package.swift file, or adding it via Perfect Assistant.\n\n``` swift\n.Package(url: \"https://github.com/PerfectlySoft/Perfect-WebRedirects\", majorVersion: 3),\n```\n\nThen in your `main.swift` file where you configure your web server, add it as an import, and add the filter:\n\n``` swift\nimport PerfectWebRedirects\n```\n\nAdding the filter:\n\n``` swift\n// Add to the \"filters\" section of the config:\n[\n\t\"type\":\"request\",\n\t\"priority\":\"high\",\n\t\"name\":WebRedirectsFilter.filterAPIRequest,\n]\n```\n\nIf you are also adding Request Logger filters, if the Web Redirects object is added second, directly after the RequestLogger filter, then both the original request (and it's associated redirect code) and the new request, will be logged correctly.\n\n## Configuration file\n\nThe configuration for the routes is included in JSON files at `/config/redirect-rules/*.json` in the form:\n\n```\n{\n\n  \"/test/no\": {\n\t\"code\": 302,\n\t\"destination\": \"/test/yes\"\n  },\n\n\t\"/test/no301\": {\n\t\t\"code\": 301,\n\t\t\"destination\": \"/test/yes\"\n  },\n  \n\t\"/test/wild/*\": {\n\t\t\"code\": 302,\n\t\t\"destination\": \"/test/wildyes\"\n  },\n\n\t\"/test/wilder/*\": {\n\t\t\"code\": 302,\n\t\t\"destination\": \"/test/wilding/*\"\n  }\n\n}\n```\n\nNote that multiple JSON files can exist in this directory - all will be loaded the first time the filter is invoked.\n\n## Compatibility with Swift\n\nThe master branch of this project currently compiles with **Xcode 9** or the **Swift 4** toolchain on Ubuntu.\n\n\n## Further Information\nFor more information on the Perfect project, please visit [perfect.org](http://perfect.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfect-webredirects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfectlysoft%2Fperfect-webredirects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfect-webredirects/lists"}