custom changes
This commit is contained in:
parent
a1671883c8
commit
abbeae7307
40
README.md
40
README.md
|
@ -1,7 +1,45 @@
|
||||||
# LegacyIP Warn
|
# LegacyIP Warn
|
||||||
|
|
||||||
This project allows you to inject an warning banner for IPv4-users with NGINX used as a proxy.
|
Fork from: [https://gitlab.com/margau_me/legacyip-warn](https://gitlab.com/margau_me/legacyip-warn)
|
||||||
|
|
||||||
|
|
||||||
|
This project allows you to inject an warning banner for IPv4-users with NGINX webserver.
|
||||||
|
|
||||||
It consists of two snippets and an example vhost configuration.
|
It consists of two snippets and an example vhost configuration.
|
||||||
|
|
||||||
Blog Post: [https://margau.net/posts/2020-09-06-legacyip-warn/](https://margau.net/posts/2020-09-06-legacyip-warn/)
|
Blog Post: [https://margau.net/posts/2020-09-06-legacyip-warn/](https://margau.net/posts/2020-09-06-legacyip-warn/)
|
||||||
|
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
copy `legacy-banner.conf` to `/etc/nginx/snippets/legacy-banner.conf`
|
||||||
|
|
||||||
|
copy `legacy-js.conf` to `/etc/nginx/snippets/legacy-js.conf`
|
||||||
|
|
||||||
|
Add the script to the site config like this:
|
||||||
|
|
||||||
|
geo $ipv4 {
|
||||||
|
0.0.0.0/0 ipv4;
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
#Listen SSL+HTTP/2
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
|
#Server Name here
|
||||||
|
|
||||||
|
include /etc/nginx/snippets/legacy-js.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
|
||||||
|
#normal location or proxy settings
|
||||||
|
|
||||||
|
# IP Legacy Banner
|
||||||
|
include /etc/nginx/snippets/legacy-banner.conf;
|
||||||
|
if ($ipv4 ~ "^$") {
|
||||||
|
set $legacy "<!-- uses IPv6 --></body>";
|
||||||
|
}
|
||||||
|
sub_filter "script-src 'unsafe-inline'" "script-src 'unsafe-inline'";
|
||||||
|
sub_filter "</body>" $legacy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ server {
|
||||||
include /etc/nginx/snippets/legacy-js.conf;
|
include /etc/nginx/snippets/legacy-js.conf;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass (...);
|
|
||||||
include /etc/nginx/proxy_params.conf;
|
#normal location or proxy settings
|
||||||
|
|
||||||
# IP Legacy Banner
|
# IP Legacy Banner
|
||||||
sub_filter_types text/html;
|
|
||||||
include /etc/nginx/snippets/legacy-banner.conf;
|
include /etc/nginx/snippets/legacy-banner.conf;
|
||||||
if ($ipv4 ~ "^$") {
|
if ($ipv4 ~ "^$") {
|
||||||
set $legacy "<!-- uses IPv6 --></body>";
|
set $legacy "<!-- uses IPv6 --></body>";
|
||||||
|
|
|
@ -26,6 +26,6 @@ set $legacy "
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div id='legacywarnoverlay'>
|
<div id='legacywarnoverlay'>
|
||||||
<p>Du besuchst diese Seite mit einem <strong>veralteten</strong> IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte Frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.<br>
|
<p>Du besuchst diese Seite mit einem <strong>veralteten</strong> IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.<br>
|
||||||
You are visiting this site with an <strong>outdated</strong> IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.<br>
|
You are visiting this site with an <strong>outdated</strong> IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.<br>
|
||||||
<a href='https://margau.net/ipv6' target='_blank'>Weitere Infos | More Information</a><br>Klicke zum schließen | Click to close</p></div></body>";
|
<a href='https://margau.net/ipv6' target='_blank'>Weitere Infos | More Information</a><br>Klicke zum schließen | Click to close</p></div></body>";
|
||||||
|
|
|
@ -6,13 +6,12 @@ function legacywarnon() {
|
||||||
|
|
||||||
function legacywarnoff() {
|
function legacywarnoff() {
|
||||||
document.getElementById('legacywarnoverlay').style.display = 'none';
|
document.getElementById('legacywarnoverlay').style.display = 'none';
|
||||||
document.cookie = 'legacywarn=true; max-age=86400 ; path=/';
|
document.cookie = 'legacywarn=true; max-age=604800; path=/';
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
document.getElementById('legacywarnoverlay').onclick = legacywarnoff;
|
document.getElementById('legacywarnoverlay').onclick = legacywarnoff;
|
||||||
if (document.cookie.indexOf('legacywarn=') > -1) {
|
if (document.cookie.indexOf('legacywarn=') > -1) {
|
||||||
document.getElementById('legacywarnoverlay').style.display = 'none';
|
document.getElementById('legacywarnoverlay').style.display = 'none';
|
||||||
console.log('Hide Legacy IP warn');
|
|
||||||
} else {
|
} else {
|
||||||
legacywarnon();
|
legacywarnon();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue