Add example
This commit is contained in:
parent
54135c56e1
commit
ba580cade1
|
@ -0,0 +1,26 @@
|
|||
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 / {
|
||||
proxy_pass (...);
|
||||
include /etc/nginx/proxy_params.conf;
|
||||
# IP Legacy Banner
|
||||
sub_filter_types text/html;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
set $legacy "
|
||||
<script src='/legacywarn.js'></script>
|
||||
<style>
|
||||
#legacywarnoverlay {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.9);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
#legacywarnoverlay p {
|
||||
padding: 10px;
|
||||
color: white;
|
||||
}
|
||||
#legacywarnoverlay p a {
|
||||
text-decoration: underline;
|
||||
color: white;
|
||||
}
|
||||
#legavywarnoverlay p a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<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>
|
||||
You are visiting this site with an <strong>outdated</strong> IPv4 internet access. Possibly in the future you may experience problems with accessibility and performance. 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>";
|
|
@ -0,0 +1,18 @@
|
|||
location /legacywarn.js {
|
||||
return 200 "
|
||||
function legacywarnon() {
|
||||
document.getElementById('legacywarnoverlay').style.display = 'block';
|
||||
}
|
||||
|
||||
function legacywarnoff() {
|
||||
document.getElementById('legacywarnoverlay').style.display = 'none';
|
||||
document.cookie = 'legacywarn=true; max-age=60*60*24 ; path=/';
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function(){
|
||||
document.getElementById('legacywarnoverlay').onclick = legacywarnoff;
|
||||
if (document.cookie.indexOf('legacywarn=') > -1) {
|
||||
document.getElementById('legacywarnoverlay').style.display = 'none';
|
||||
console.log('Hide Legacy IP warn');
|
||||
}
|
||||
});";
|
||||
}
|
Loading…
Reference in New Issue