Add 127.0.0.1 and format shell scripts

This commit is contained in:
Eric Nemchik
2023-01-16 10:42:58 -06:00
parent c0a73748fb
commit 01f83ec708
3 changed files with 29 additions and 33 deletions
+3 -25
View File
@@ -1,6 +1,6 @@
# cloudflare_real-ip - Docker mod for SWAG
This mod adds a startup script that gets the IPs from Cloudflare's edge servers, and formats them in a format Nginx can use with `set_real_ip_from`.
This mod adds a startup script that gets the IPs from Cloudflare's edge servers, and outputs them in a format Nginx can use with `set_real_ip_from`.
It reads this [list for IPv4](https://www.cloudflare.com/ips-v4), and this [list for IPV6](https://www.cloudflare.com/ips-v6).
@@ -22,31 +22,9 @@ include /config/nginx/cf_real-ip.conf;
~~I also recommend including your docker-network as a valid ip `set_real_ip_from 172.17.0.0/16;` in the snippet above.~~
This mod now also *tries* to set the real ip from the interfaces in the container.
## Cloudflare tunnels
In case you use Cloudflare tunnels, real IP might be reported in containers as 127.0.0.1.
In this case, please add below to `http` section of `nginx.conf`.
From:
```nginx
real_ip_header X-Forwarded-For;
real_ip_recursive on;
include /config/nginx/cf_real-ip.conf;
```
to:
```nginx
real_ip_header X-Forwarded-For;
real_ip_recursive on;
include /config/nginx/cf_real-ip.conf;
set_real_ip_from 127.0.0.1;
```
This mod now adds `127.0.0.1` and *tries* to add the real ip from the interfaces in the container.
## Versions
* **16.01.23:** - Add 127.0.0.1 and format shell scripts.
* **21.01.21:** - Fix bug when mod runs before internet-access.