Browse Source

Merge pull request #73 from RyoshiKayo/master

Added CF-Connecting-IP
Kana 6 years ago
parent
commit
917cdabcb0
5 changed files with 44 additions and 1 deletions
  1. 3 0
      README.md
  2. 5 0
      nginx-ssl.sample.conf
  3. 5 0
      nginx.sample.conf
  4. 1 1
      pages/home.html
  5. 30 0
      real-ip-from-cf

File diff suppressed because it is too large
+ 3 - 0
README.md


+ 5 - 0
nginx-ssl.sample.conf

@@ -21,6 +21,11 @@ server {
 
 	client_max_body_size 100M; # Change this to the max file size you want to allow
 
+	# Uncomment if you are running lolisafe behind CloudFlare.
+	# This requires NGINX compiled from source with:
+	#	--with-http_realip_module
+	#include /path/to/lolisafe/real-ip-from-cf;
+
 	location / {
 		add_header Access-Control-Allow-Origin *;
 		root /path/to/your/uploads/folder;

+ 5 - 0
nginx.sample.conf

@@ -10,6 +10,11 @@ server {
 
 	client_max_body_size 100M; # Change this to the max file size you want to allow
 
+	# Uncomment if you are running lolisafe behind CloudFlare.
+	# This requires NGINX compiled from source with:
+	#	--with-http_realip_module
+	#include /path/to/lolisafe/real-ip-from-cf;
+
 	location / {
 		add_header Access-Control-Allow-Origin *;
 		root /path/to/your/uploads/folder;

+ 1 - 1
pages/home.html

@@ -82,7 +82,7 @@
 
 					<h3 class="subtitle"><a href="/auth" id="loginLinkText"></a></h3>
 					<h3 id="links">
-						<a href="https://github.com/kanadeko/loli-safe" target="_blank" class="is-danger">View on GitHub</a><span>|</span><a id="ShareX" href="https://lolisafe.moe/sharex.txt">ShareX</a><span>|</span><a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" target="_blank" class="is-danger">Chrome extension</a><span>|</span><a href="/faq" class="is-danger">FAQ</a><span>|</span><a href="/auth" target="_blank" class="is-danger">Dashboard</a>
+						<a href="https://github.com/WeebDev/lolisafe" target="_blank" class="is-danger">View on GitHub</a><span>|</span><a id="ShareX" href="https://lolisafe.moe/sharex.txt">ShareX</a><span>|</span><a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" target="_blank" class="is-danger">Chrome extension</a><span>|</span><a href="/faq" class="is-danger">FAQ</a><span>|</span><a href="/auth" target="_blank" class="is-danger">Dashboard</a>
 					</h3>
 
 				</div>

+ 30 - 0
real-ip-from-cf

@@ -0,0 +1,30 @@
+# https://www.cloudflare.com/ips/
+
+# IPv4 Ranges
+# https://www.cloudflare.com/ips-v4/
+set_real_ip_from 103.21.244.0/22;
+set_real_ip_from 103.22.200.0/22;
+set_real_ip_from 103.31.4.0/22;
+set_real_ip_from 104.16.0.0/12;
+set_real_ip_from 108.162.192.0/18;
+set_real_ip_from 131.0.72.0/22;
+set_real_ip_from 141.101.64.0/18;
+set_real_ip_from 162.158.0.0/15;
+set_real_ip_from 172.64.0.0/13;
+set_real_ip_from 173.245.48.0/20;
+set_real_ip_from 188.114.96.0/20;
+set_real_ip_from 190.93.240.0/20;
+set_real_ip_from 197.234.240.0/22;
+set_real_ip_from 198.41.128.0/17;
+
+# IPv6 Ranges
+# https://www.cloudflare.com/ips-v6/
+set_real_ip_from 2400:cb00::/32;
+set_real_ip_from 2405:8100::/32;
+set_real_ip_from 2405:b500::/32;
+set_real_ip_from 2606:4700::/32;
+set_real_ip_from 2803:f800::/32;
+set_real_ip_from 2c0f:f248::/32;
+set_real_ip_from 2a06:98c0::/29;
+
+real_ip_header CF-Connecting-IP;