aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ed5ccc563c82ff3622e6235f0ca6771801e51804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!--
 .. File: README.md
 .. Location: https://bgstack15.ddns.net/cgit/outbound/
 .. Author: bgstack15
 .. SPDX-License-Identifier: GPL-3.0
 .. Startdate: 2022-11-28
 .. Title: Readme for Outbound project
 .. Project: outbound
 .. Purpose: Describe the project
 .. History:
 .. Usage:
 .. Reference: See References heading
 .. Improvements:
 .. Documentation: this file
 .. Dependencies:
 -->
# README for outbound
This project is a small Flask app that merely redirects to the link farther down the URL. The purpose is to enable my web server to record visits to outbound links. This is not a URL shortener or obfuscator. It's a cheap way for me to see what links my site vistors use, without using javascript.

## Upstream
The original project is at <https://bgstack15.ddns.net/cgit/outbound/>.

## Features/design goals

* redirect only if referer is in whitelist
* simple web config
* simple app config
* send to web server logs the redirects, or else 404s for invalid link requests

## Alternatives
Probably some "proper" web analytics suite or javascript garbage that I do not want to learn or use.

## Reason for existence
To show what links on my site are used.

## Using

### Web app
Run a simple dev environment.

    FLASK_APP=outbound.py FLASK_DEBUG=True flask run --host=0.0.0.0 --extra-files outbound.conf

### Testing the web app with curl

    $ curl --header "Referer: http://d2-03a:5000/" --header 'Debug: true' http://d2-03a:5000/http://server3/
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <title>Redirecting...</title>
    <h1>Redirecting...</h1>
    <p>You should be redirected automatically to target URL: <a href="http://server3/">http://server3/</a>. If not click the link.

## Improvements

* Provide an apache wsgi config?
* Provide an nginx wsgi config?

## Dependencies
For the web app:

* apache with `mod_wsgi`
* python3-flask

## References

1. [fuss.conf.example](https://bgstack15.ddns.net/cgit/fuss/tree/fuss.conf.example)
2. [fuss.py](https://bgstack15.ddns.net/cgit/fuss/tree/fuss.py)
3. [coupons_web.py](https://bgstack15.ddns.net/cgit/coupons/tree/coupons_web.py)
4. <https://werkzeug.palletsprojects.com/en/2.2.x/serving/#werkzeug.serving.run_simple>
5. various [fifconfig](https://bgstack15.ddns.net/cgit/fifconfig/tree/) files

### Internal documents

1. ports.txt: outbound    4682/tcp
bgstack15