/yourls_reverseproxy

Fixes the incoming IPs when using YOURLS after a reverse proxy (ie. CloudFlare, Heroku or the likes)

Primary LanguagePHP

YOURLS Reverse Proxy Plugin

Fixes the user IPs to point to the actual user instead of your cloud provider’s infrastructure IPs, for now the following providers and their headers are supported:

  • Cloudflare: This information is gathered from CF-Connecting-IP and applied as a filter to yourls_get_IP()
  • Heroku: This information is gathered from X-Forwarded-For and applied as a filter to yourls_get_IP()

Why?

Due to how CloudFlare is essentially a reverse proxy between your server and the internet at large, your server will end up seeing the reverse proxy instead of the client requesting the pagethe server will see the proxy IPs instead of the real IP that1
and Heroku has router infrastructure which behaves in a similar fashion.3

Installation

  1. Fetch/pull/download the repo
  2. Copy the folder reverseproxy into YOURLS_ABSPATH/user/plugins where YOURLS_ABSPATH is the location your YOURLS install is located in.
  3. Activate plugin on administrator interface.
  4. ???
  5. Profit!

1 https://support.cloudflare.com/hc/en-us/articles/200170786-Restoring-original-visitor-IPs-Logging-visitor-IP-addresses-with-mod-cloudflare--

2 https://devcenter.heroku.com/articles/http-routing#heroku-headers