{"id":159,"date":"2019-12-28T15:00:57","date_gmt":"2019-12-28T15:00:57","guid":{"rendered":"https:\/\/online.osba.nl\/blog\/?p=159"},"modified":"2019-12-28T15:01:03","modified_gmt":"2019-12-28T15:01:03","slug":"adding-x-clacks-overhead","status":"publish","type":"post","link":"https:\/\/blog.osba.nl\/en\/2019\/12\/28\/adding-x-clacks-overhead\/","title":{"rendered":"Adding X-Clacks-Overhead"},"content":{"rendered":"\n<p>For a long time on my to-do list, but postponed due to perceived complexity: adding X-Clacks-Overhead. <\/p>\n\n\n\n<p>Now I got around to looking into what is actually involved, and&#8230; It&#8217;s not all that convoluted. For nginX it a single line to be added in a server, location or http block. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add_header X-Clacks-Overhead \"GNU Terry Pratchett\" always;<\/pre>\n\n\n\n<p>Next up was finding the right file in the Yunohost setup of nginX: I did find a single (default) sites-available, but no sites-enabled. <\/p>\n\n\n\n<p>All configuration is put in the conf-directories, where I put the additional header in the conf of the main site in the server section. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/etc\/nginx\/conf.d\/mysite.tld.conf<\/pre>\n\n\n\n<p>Now first see that the header is not there before reloading nginX:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">~# curl -IL mysite.tld\n HTTP\/1.1 302 Moved Temporarily\n Server: nginx\n Date: Sat, 28 Dec 2019 11:23:13 GMT\n Content-Type: text\/html\n Content-Length: 154\n Connection: keep-alive\n X-SSO-WAT: You've just been SSOed\n Location: https:\/\/mysite.tld\/yunohost\/sso\/?r=aHR0cHM6Ly9zYW55aS5ubC8=\n<\/pre>\n\n\n\n<p>See? No X-Clacks header. Reload nginX&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service nginx reload <\/pre>\n\n\n\n<p>&#8230; and have a look at the headers again:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">~# curl -IL mysite.tld<br> HTTP\/1.1 302 Moved Temporarily<br> Server: nginx<br> Date: Sat, 28 Dec 2019 11:25:52 GMT<br> Content-Type: text\/html<br> Content-Length: 154<br> Connection: keep-alive<br> X-SSO-WAT: You've just been SSOed<br> Location: https:\/\/mysite.tld\/yunohost\/sso\/?r=aHR0cHM6Ly9zYW55aS5ubC8=<br> X-Clacks-Overhead: GNU Terry Pratchett<\/pre>\n\n\n\n<p>It now shows at the bottom line.<\/p>\n\n\n\n<p>Actually the X-Clacks-Overhead is only added to the HTTP 1.1 headers. The HTTP 2 headers omit the header at the moment. After rereading the config, I added the header to the server listening at port 80 over HTTP 1.1; it gets forwarded to port 443 over HTTP 2. That block did not have the header. After adding the header there as well, the HTTP 2 headers show the X-Clacks-Overhead as well: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">~# curl -IL mysite.tld\n HTTP\/2 404 \n server: nginx\n date: Sat, 28 Dec 2019 11:33:18 GMT\n content-type: text\/html\n content-length: 162\n x-sso-wat: You've just been SSOed\n set-cookie: SSOwAuthRedirect=;; Path=\/yunohost\/sso\/; Expires=Thu, 01 Jan 1970 00:00:00 UTC; Secure; HttpOnly; SameSite=Lax ;;\n strict-transport-security: max-age=63072000; includeSubDomains; preload\n content-security-policy: upgrade-insecure-requests\n content-security-policy-report-only: default-src https: data: 'unsafe-inline' 'unsafe-eval'\n x-content-type-options: nosniff\n x-xss-protection: 1; mode=block\n x-download-options: noopen\n x-permitted-cross-domain-policies: none\n x-frame-options: SAMEORIGIN\n x-clacks-overhead: GNU Terry Pratchett<\/pre>\n\n\n\n<p>One difference between the two header blocks, is that the HTTP1.1 block is capitalized, whereas the HTTP2 block is not. Fine with me \ud83d\ude42<\/p>\n\n\n\n<p>So, two points of my mental to-do list, one for the Clacks itself and one for moving it from a mental to-do list to a physical (of some sort) to-do list. <\/p>\n<p class=\"wpf_wrapper\"><a class=\"print_link\" href=\"\" target=\"_blank\">Print this entry<\/a><\/p><!-- .wpf_wrapper -->","protected":false},"excerpt":{"rendered":"<p>For a long time on my to-do list, but postponed due to perceived complexity: adding X-Clacks-Overhead. Now I got around to looking into what is actually involved, and&#8230; It&#8217;s not all that convoluted. For nginX it a single line to be added in a server, location or http block. add_header X-Clacks-Overhead &#8220;GNU Terry Pratchett&#8221; always; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.osba.nl\/en\/2019\/12\/28\/adding-x-clacks-overhead\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adding X-Clacks-Overhead&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"159","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-uncategorized","en-US"],"_links":{"self":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":1,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/159\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}