{"id":177,"date":"2023-04-05T21:15:36","date_gmt":"2023-04-05T19:15:36","guid":{"rendered":"https:\/\/gilbert.busana.lu\/?p=177"},"modified":"2023-04-05T21:15:36","modified_gmt":"2023-04-05T19:15:36","slug":"nginx-display-reverse-proxy-headers","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=177","title":{"rendered":"NGINX: display reverse proxy headers"},"content":{"rendered":"\n<p>If you are having trouble with a web application sitting behind a reverse proxy, debugging can be facilitated by having your (backend) web-server displaying the headers that it receives. <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"headers.php\" data-lang=\"PHP\"><code>&lt;?php\necho \u201c&lt;h1&gt;Headers received from the reverse proxy&lt;\/h1&gt;&quot;;\n$headers =  getallheaders();\nforeach($headers as $key=&gt;$val){\n  echo $key . &#39;: &#39; . $val . &#39;&lt;br&gt;&#39;;\n}\n?&gt;<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>parameter 1<\/th><th>parameter 2<\/th><th class=\"has-text-align-center\" data-align=\"center\">output<\/th><\/tr><\/thead><tbody><tr><td>proxy_set_header<\/td><td>X-Real-IP<\/td><td>$remote_addr;<\/td><td class=\"has-text-align-center\" data-align=\"center\">IP Address of client<\/td><\/tr><tr><td>proxy_set_header<\/td><td>X-Forwarded-For<\/td><td>$proxy_add_x_forwarded_for;<\/td><td class=\"has-text-align-center\" data-align=\"center\">IP Address of client<\/td><\/tr><tr><td>proxy_set_header<\/td><td>X-Forwarded-Host<\/td><td>$server_name;<\/td><td class=\"has-text-align-center\" data-align=\"center\">called vhost<\/td><\/tr><tr><td>proxy_set_header<\/td><td>X-Forwarded-Proto<\/td><td>$scheme;<\/td><td class=\"has-text-align-center\" data-align=\"center\">https or http<\/td><\/tr><tr><td>proxy_set_header<\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><tr><td><\/td><td><\/td><td><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Header commands and outputs<\/figcaption><\/figure>\n\n\n\n<p>If you want to test how your page and headers look like from outside, call it from a site like <a rel=\"noreferrer noopener\" href=\"https:\/\/testlocal.ly\" target=\"_blank\">https:\/\/testlocal.ly<\/a> .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are having trouble with a web application sitting behind a reverse proxy, debugging can be facilitated by having your (backend) web-server displaying the headers that it receives. Command parameter 1 parameter 2 output proxy_set_header X-Real-IP $remote_addr; IP Address of client proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; IP Address of client proxy_set_header X-Forwarded-Host $server_name; called vhost proxy_set_header [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-reverse-proxy"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177"}],"version-history":[{"count":8,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}