Last active
September 11, 2015 03:02
-
-
Save sebble/f3b21711524313090b7a to your computer and use it in GitHub Desktop.
Nginx Remote IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $http_user_agent $mode { | |
default 'plain'; | |
~*(Mozilla) 'html'; | |
} | |
map $http_user_agent $html { | |
default ''; | |
~*(Mozilla) '<title>$remote_addr</title>'; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
location = /ip { | |
more_set_headers 'Content-Type: text/$mode'; | |
echo -n $html; | |
echo -n $remote_addr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment