Skip to content

Instantly share code, notes, and snippets.

@EdwardNavarro
Forked from ragingwind/nginx.conf
Created July 17, 2020 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwardNavarro/129664e748bcb2bc1cecaa127e892715 to your computer and use it in GitHub Desktop.
Save EdwardNavarro/129664e748bcb2bc1cecaa127e892715 to your computer and use it in GitHub Desktop.
Redirect old-classic browser including IE 11
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_user_agent $outdated {
default 0;
"~MSIE [1-10]\." 1;
"~Trident/[5-7]\." 1;
"~Mozilla.*Firefox/[1-9]\." 1;
"~Mozilla.*Firefox/[0-2][0-9]\." 1;
"~Mozilla.*Firefox/3[0-1]\." 1;
"~Opera.*Version/[0-9]\." 1;
"~Opera.*Version/[0-1][0-9]\." 1;
"~Opera.*Version/2[0-1]\." 1;
"~AppleWebKit.*Version/[0-6]\..*Safari" 1;
"~Chrome/[0-9]\." 1;
"~Chrome/[0-2][0-9]\." 1;
"~Chrome/3[0-3]\." 1;
}
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
if ($outdated = 1) {
rewrite ^ /outdated.html redirect;
}
}
location = /outdated.html {
root /usr/share/nginx/html;
index outdated.html;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment