redirectly 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +130 -0
- data/lib/redirectly/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07d69d903b03e28e92766735ab44db1c243bbae86491a43b9ff0b24de325ebbc
|
4
|
+
data.tar.gz: f3f48ba2349caf72bd63613537d638558a0a0cac0374ba29931a6dd3b8b0cb20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff123b2ad167f2088cb7bbf9f4b66b450e17ad9eea457d3f201f4dde8819a9d8fcc9ec1e9997df0ec1ee5838ab0eeb536501d9f54f80490ac05d1c7b650d146
|
7
|
+
data.tar.gz: ce4b1c849af4cd096ae5caeca10ae92b873098f5c1890954b0eaa1930ef07fff1fc8c1e14666f3ddad940b75460d58fb3c78cb88a355ac9ea7bb2dfb06947437
|
data/README.md
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# Redirectly - Redirect server with dynamic URL and hostname support
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/redirectly.svg)](https://badge.fury.io/rb/redirectly)
|
4
|
+
[![Build Status](https://github.com/DannyBen/redirectly/workflows/Test/badge.svg)](https://github.com/DannyBen/redirectly/actions?query=workflow%3ATest)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/094281e5b8e90b8ff85f/maintainability)](https://codeclimate.com/github/DannyBen/redirectly/maintainability)
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
Redirectly is a simple URL redirect server that uses a simple INI file for
|
10
|
+
defining dynamic redirects.
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
## Install
|
15
|
+
|
16
|
+
```
|
17
|
+
$ gem install redirectly
|
18
|
+
```
|
19
|
+
|
20
|
+
## Docker Image
|
21
|
+
|
22
|
+
Redirectly is also available as a [docker image][docker]:
|
23
|
+
|
24
|
+
```shell
|
25
|
+
# Pull the image
|
26
|
+
$ docker pull dannyben/redirectly
|
27
|
+
|
28
|
+
# Run the redirectly command line
|
29
|
+
$ docker run --rm -it dannyben/redirectly --help
|
30
|
+
|
31
|
+
# Start the server with your local configuration file
|
32
|
+
$ docker run --rm -it \
|
33
|
+
-p 3000:3000 \
|
34
|
+
-v $PWD/redirects.ini:/app/redirects.ini \
|
35
|
+
dannyben/redirectly
|
36
|
+
```
|
37
|
+
|
38
|
+
### Using with docker-compose
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
# docker-compose.yml
|
42
|
+
services:
|
43
|
+
redirectly:
|
44
|
+
image: dannyben/redirectly
|
45
|
+
ports:
|
46
|
+
- 3000:3000
|
47
|
+
volumes:
|
48
|
+
- ./redirects.ini:/app/redirects.ini
|
49
|
+
```
|
50
|
+
|
51
|
+
### Using as an alias
|
52
|
+
|
53
|
+
```shell
|
54
|
+
$ alias redirectly='docker run --rm -it -p 3000:3000 -v $PWD/redirects.ini:/app/redirects.ini dannyben/redirectly'
|
55
|
+
```
|
56
|
+
|
57
|
+
## Quick Start
|
58
|
+
|
59
|
+
```shell
|
60
|
+
# In an empty directory, create a sample configuration file
|
61
|
+
$ redirectly --init
|
62
|
+
|
63
|
+
# Start the server
|
64
|
+
$ redirectly
|
65
|
+
|
66
|
+
# In another terminal, access the server using one of the configured rules
|
67
|
+
$ curl -v something.lvh.me:3000
|
68
|
+
```
|
69
|
+
|
70
|
+
You should receive a redirect header:
|
71
|
+
|
72
|
+
```shell
|
73
|
+
# ...
|
74
|
+
< HTTP/1.1 302 Found
|
75
|
+
< Location: http://it-works.com/something
|
76
|
+
# ...
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
## Usage
|
81
|
+
|
82
|
+
Redirectly requires a simple INI file with redirect configuration details.
|
83
|
+
|
84
|
+
You can create a sample configuration file by running:
|
85
|
+
|
86
|
+
```shell
|
87
|
+
$ redirectly --init
|
88
|
+
```
|
89
|
+
|
90
|
+
This will create a sample `redirects.ini` file:
|
91
|
+
|
92
|
+
```ini
|
93
|
+
example.com = https://other-site.com/
|
94
|
+
*.mygoogle.com/:anything = https://google.com/?q=%{anything}
|
95
|
+
example.org/* = https://other-site.com/
|
96
|
+
*.old-site.com = !https://permanent.redirect.com
|
97
|
+
:sub.lvh.me/* = http://it-works.com/%{sub}
|
98
|
+
```
|
99
|
+
|
100
|
+
For additional server options, see:
|
101
|
+
|
102
|
+
```shell
|
103
|
+
$ redirectly --help
|
104
|
+
```
|
105
|
+
|
106
|
+
The configuration file is built of `pattern = target` pairs, where:
|
107
|
+
|
108
|
+
- `pattern` - is any URL pattern that is supported by [Mustermann][mustermann].
|
109
|
+
- `target` - is the target URL to redirect to.
|
110
|
+
|
111
|
+
Notes:
|
112
|
+
|
113
|
+
- If `target` starts with an exclamation mark, it will be a permanent
|
114
|
+
redirect (301), otherwise it will be a temporary redirect (302).
|
115
|
+
- If `pattern` includes named arguments (e.g. `example.com/:something`), they
|
116
|
+
will be available to the `target` as Ruby string substitution variables
|
117
|
+
(e.g. `%{something}`).
|
118
|
+
|
119
|
+
|
120
|
+
## Contributing / Support
|
121
|
+
|
122
|
+
If you experience any issue, have a question or a suggestion, or if you wish
|
123
|
+
to contribute, feel free to [open an issue][issues].
|
124
|
+
|
125
|
+
|
126
|
+
---
|
127
|
+
|
128
|
+
[issues]: https://github.com/DannyBen/redirectly/issues
|
129
|
+
[mustermann]: https://github.com/sinatra/mustermann/blob/master/mustermann/README.md
|
130
|
+
[docker]: https://hub.docker.com/r/dannyben/redirectly
|
data/lib/redirectly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redirectly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
@@ -66,13 +66,14 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.3'
|
69
|
-
description: Redirect server with
|
69
|
+
description: Redirect server with dynamic URL and hostname support
|
70
70
|
email: db@dannyben.com
|
71
71
|
executables:
|
72
72
|
- redirectly
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- README.md
|
76
77
|
- bin/redirectly
|
77
78
|
- lib/redirectly.rb
|
78
79
|
- lib/redirectly/app.rb
|