
The other day while perusing Twitter, I came across a Tweet mentioning icanhazip.com, a site I regularly use to confirm either my IPv4 or IPv6 public IP address.
The site is run by Major Hayden who I also happen to follow on Twitter. The combination of the two yielded me coming across the following tweet by @elenalindq in my feed about a Duck emoji in the header of the site:
curl -IL https://icanhazip.com
HTTP/2 200
server: nginx
date: Tue, 15 Sep 2020 03:32:56 GMT
content-type: text/plain; charset=UTF-8
content-length: 13
access-control-allow-origin: *
access-control-allow-methods: GET
x-rtfm: Learn about this site at http://bit.ly/icanhazip-faq and do not abuse the service.
x-node: icanhazip-dfw-1
x-donation: This site is expensive to run. You can donate BTC to 3LSp89k9qnMJBpV7AUNF3M2Eo1vatpkYpm
x-duck: 🦆
That lead me to locate other Tweets and posts about using emoji’s in NGINX headers, or HTTP headers as a whole. Some further digging is showing that as long as the UTC-8 character set is enabled on the server, the use of emoji’s within the NGINX configuration file should work.
I went on to test various emoji setups out by setting various headers within placeonthe.net’s configuration file. While trying out different emoji’s, I did note that using the actual unicode for the emoji did not render correctly.
I eventually found an NGINX article covering the use of emoji’s within the NGINX configuration file at Introducing Full Emoji Support in NGINX and NGINX Plus Configuration. The article indicated just copying the emoji in to the configuration file will allow it to be used in even more ways than just returning a header.
I eventually found a good list of emoji’s to test within the configuration file and how they would look when being viewed via cURL in this case.. I eventually settled on the glorious donut: 🍩
curl -IL https://placeonthe.net
HTTP/2 200
date: Tue, 15 Sep 2020 03:49:38 GMT
content-type: text/html; charset=UTF-8
set-cookie: __cfduid=d793486fe2bfb7cdbbfdb49f9b449b6541600141777; expires=Thu, 15-Oct-20 03:49:37 GMT; path=/; domain=.placeonthe.net; HttpOnly; SameSite=Lax
vary: Accept-Encoding
vary: Accept-Encoding
set-cookie: wp_visit_time_test=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0
link: <https://placeonthe.net/wp-json/>; rel="https://api.w.org/"
x-powered-by: WP Engine
x-cacheable: SHORT
vary: Accept-Encoding,Cookie
cache-control: max-age=600, must-revalidate
x-cache: MISS
x-cache-group: normal
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-donut: : 🍩
cf-cache-status: DYNAMIC
cf-request-id: 05317af42a0000bb1600ae9200000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 5d2f61004a11bb16-SEA
So far I have tested this on Ubuntu, OSX and OpenBSD using iTerm2 without issues and using Chrome’s Dev Tools to view headers too. I was able to open the NGINX configuration file using vim and the emoji was present. Parsing the configuration file also did not return any errors!
In order to set the actual header in the configuration file I merely applied the following header:
add_header X-Donut: "🍩";
I have found a few interesting examples online of using the headers more as comical representations than for anything beyond that, but it’s certainly a quirky feature. Definitely an interesting concept I will continue to explore.