https://github.com/mamoruds/redir_page
Github page for url redirection
https://github.com/mamoruds/redir_page
url-redirect
Last synced: about 1 month ago
JSON representation
Github page for url redirection
- Host: GitHub
- URL: https://github.com/mamoruds/redir_page
- Owner: MamoruDS
- Created: 2020-03-02T22:13:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-23T08:25:40.000Z (almost 3 years ago)
- Last Synced: 2025-02-22T19:51:07.397Z (over 1 year ago)
- Topics: url-redirect
- Language: TypeScript
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redir Page
URL scheme is a nice to have feature, but it is not as easy to use as a normal URL, which you can access with a single click on a website or any IM app. This repository allows you to access your URL scheme easily through redirection.
## Usage
You have the option to use either the Redir Page through GitHub Page or Cloudflare Worker. The GH Pager version will simply open the target URL in your browser, whereas the CF Worker version uses HTTP redirection and offers additional features, such as UA filtering and token authentication.
### Use via GitHub Page
```
https://mamoruds.github.io/redir_page/?redir=
```
Example:
```
shortcuts://run-shortcut?name=Show clipboard content
```
Original url should be encoded:
```
https://mamoruds.github.io/redir_page?redir=shortcuts%3A%2F%2Frun-shortcut%3Fname%3DShow%20clipboard%20content
```
### Use via Cloudflare Worker
First, deploy the worker to your Cloudflare account
```shell
git clone https://github.com/MamoruDS/redir_page.git \
&& cd redir_page/worker
# fill in the KV binding in wrangler.toml before publishing
wrangle publish
```
You can now access your URL scheme with the same usage as the GH Pager version
```yaml
https:///?redir=
# example
https://redir.foo.workers.dev/?redir=shortcuts%3A%2F%2Frun-shortcut%3Fname%3DShow%20clipboard%20content
```
To enable more advanced features, you can add redir records in the KV. The records are stored in YAML and have the following interface:
```typescript
type RedirRec = {
value: string
fake_value?: string
ua_excludes?: string[] // regex patterns
require_token?: boolean
tokens?: {
value: string
expire: number // -1 for never expire
}[]
enabled: boolean
}
```
Example:
```yaml
# key=demo01
value: tg://open
fake_value: shortcuts://run-shortcut?name=Show clipboard content
ua_excludes:
- Macintosh.*Safari
- Chrome
- Firefox\/1\d{2}
enabled: true
```
```shell
curl -A 'Chrome' -I 'https://redir.foo.workers.dev/?key=demo01'
# HTTP/1.1 302 Found
# date: Sun, 09 Apr 2023 10:41:11 GMT
# location: shortcuts://run-shortcut?name=Show%20clipboard%20content
# ...
```