{"id":3227,"date":"2021-08-02T11:08:25","date_gmt":"2021-08-02T10:08:25","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3227"},"modified":"2021-08-02T11:08:25","modified_gmt":"2021-08-02T10:08:25","slug":"apache2-redirect-from-http-to-https-with-some-source-ip-based-exceptions","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2021\/08\/apache2-redirect-from-http-to-https-with-some-source-ip-based-exceptions\/","title":{"rendered":"apache2 &#8211; redirect from http to https with some source-ip-based exceptions"},"content":{"rendered":"<p>i was migrating a server from http to https. while header-based redirect worked for most of the clients, for some &#8211; i had to allow for a transition period where some configuration \/ code had to be adjusted.<\/p>\n<p>here&#8217;s the config that responds with 302 redir to most of the http requests, but for those coming from very specific hosts, still serves content via http:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;VirtualHost *:80&gt;\r\n ServerName name.of.the.server\r\n &#x5B;..]\r\n RewriteEngine On\r\n RewriteCond %{REMOTE_ADDR} !10.2.1.10\r\n RewriteCond %{REMOTE_ADDR} !10.3.11.2\r\n RewriteRule ^(.*)$ https:\/\/name.of.the.server\/$1\r\n &#x5B;..]\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>i was migrating a server from http to https. while header-based redirect worked for most of the clients, for some &#8211; i had to allow for a transition period where some configuration \/ code had to be adjusted. here&#8217;s the config that responds with 302 redir to most of the http requests, but for those [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,51],"tags":[],"class_list":["post-3227","post","type-post","status-publish","format-standard","hentry","category-tech","category-unimportant"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3227"}],"version-history":[{"count":1,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3227\/revisions"}],"predecessor-version":[{"id":3228,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3227\/revisions\/3228"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}