[{"data":1,"prerenderedAt":301},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2008\u002F02\u002F29\u002Fapache2-namevirtualhosts-ssl-and-server-port\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":5,"date":286,"description":213,"embedImage":287,"extension":288,"image":287,"intro":287,"meta":289,"navigation":290,"path":291,"seo":292,"series":287,"sitemap":293,"stem":294,"tags":295,"__hash__":300},"content\u002F2008\u002F02\u002F29\u002Fapache2-namevirtualhosts-ssl-and-server-port.md","Apache2, NameVirtualHosts, SSL and SERVER_PORT",{"type":208,"value":209,"toc":283},"minimark",[210,214,222,225,228,239,242,248,251,265,271,274,277],[211,212,213],"p",{},"I was experiencing odd things integrating to google maps - although I have both an API key for http and https - only https was working.",[211,215,216,217,221],{},"It turns out that the setting of the apache environment variable SERVER_PORT was ",[218,219,220],"em",{},"always"," 443 irrespective of whether I was using http\u002F80 or https\u002F443 from the client.",[211,223,224],{},"I have several NameVirtualHosts on different IPs.",[211,226,227],{},"In apache2.conf:",[229,230,235],"pre",{"className":231,"code":233,"language":234},[232],"language-text","NameVirtualHost 78.47.168.122:80\nNameVirtualHost 78.47.168.123:80\nNameVirtualHost 78.47.168.124:80\nNameVirtualHost 78.47.168.124:443\nNameVirtualHost 78.47.168.125:80\nNameVirtualHost 78.47.168.125:443\nNameVirtualHost 78.47.168.126:80\nNameVirtualHost 78.47.168.126:443\n\n# Include the virtual host configurations:\nInclude \u002Fetc\u002Fapache2\u002Fsites-enabled\u002F\n","text",[236,237,233],"code",{"__ignoreMap":238},"",[211,240,241],{},"And in one of my more complex virtual files I had the following:",[229,243,246],{"className":244,"code":245,"language":234},[232],"\u003CVirtualHost 78.47.168.125:80 78.47.168.125:443>\n",[236,247,245],{"__ignoreMap":238},[211,249,250],{},"This was making the site available under both http and https - and for https only functions I was using the SSLRequireSSL statement.",[211,252,253,254,264],{},"But - by using the following test code (thanks once again to Steve Kemp of ",[255,256,263],"a",{"href":257,"rel":258,"target":262},"http:\u002F\u002Fwww.debian-administration.org",[259,260,261],"nofollow","noopener","noreferer","_blank","www.debian-administration.org","):",[229,266,269],{"className":267,"code":268,"language":234},[232],"#!\u002Fusr\u002Fbin\u002Fperl\nprint \"Content-Type: text\u002Fplain\\n\\n\";\n\nforeach my $key ( sort keys %ENV )\n{\n    print \"Key $key \" . $ENV{$key} . \"\\n\";\n}\n",[236,270,268],{"__ignoreMap":238},[211,272,273],{},"I could show that SERVER_PORT was not correct when accessing via HTTP on port 80.",[211,275,276],{},"By changing that single virtual host config to have two \u003CVirtualHost> sections - one for each port - this issue goes away. However - I do end up with duplicated config:",[229,278,281],{"className":279,"code":280,"language":234},[232],"\u003CVirtualHost 78.47.168.125:80>\n  HTTP only site config here\n\u003C\u002FVirtualHost>\n\u003CVirtualHost 78.47.168.125:443>\n  Complete site config here (all the ssl stuff plus a duplicate of the http stuff above)\n>\u002FVirtualHost>\n",[236,282,280],{"__ignoreMap":238},{"title":238,"searchDepth":284,"depth":284,"links":285},2,[],"2008-02-29 22:53:22 +0100",null,"md",{},true,"\u002F2008\u002F02\u002F29\u002Fapache2-namevirtualhosts-ssl-and-server-port",{"title":206,"description":213},{"loc":291},"2008\u002F02\u002F29\u002Fapache2-namevirtualhosts-ssl-and-server-port",[296,297,298,299],"ssl","apache2","namevirtualhost","php","acPvZILJbk1zG09B_aLcEq9gTsSzVKBSoXrnZrQfo60",1775293015783]