*https://kamranicus.com/posts/2016-03-06-cors-multiple-origins-iis
Managing IIS Log files
https://www.iis.net/learn/manage/provisioning-and-managing-iis/managing-iis-log-file-storage
Note: When running above script as a Scheduled task make sure
* W2012R2 - Install PHP
Reference: https://technet.microsoft.com/en-us/library/hh994592(v=ws.11).aspx\\
<?php phpinfo(); ?>
/data/
/conf/
/bin/
/inc/
extension_dir = "ext"
extension=php_openssl.dll
Below is the powershell script which Cisco CCE uses to install IIS
import-module ServerManager Install-WindowsFeature Web-Server,Web-Net-Ext45, Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Request-Monitor,Web-Basic-Auth,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="https://*.mydomain.com" /> <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" /> <add name="Access-Control-Allow-Headers" value="Content-Type, Authorization" /> <add name="Access-Control-Allow-Credentials" value="true" /> </customHeaders> </httpProtocol> <staticContent> <clientCache cacheControlMaxAge="00:30:00" cacheControlMode="UseMaxAge" /> </staticContent> </system.webServer> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <outboundRules> <rule name="Set CORS for Allowed Domains" enabled="true"> <match serverVariable="RESPONSE_Access-Control-Allow-Origin" pattern=".*" /> <conditions> <add input="{HTTP_ORIGIN}" pattern="^(https://([a-z0-9-]+\.)?mydomain\.com|https://example\.com)$" /> </conditions> <action type="Rewrite" value="{HTTP_ORIGIN}" /> </rule> </outboundRules> </rewrite> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" /> <add name="Access-Control-Allow-Headers" value="Content-Type, Authorization" /> <add name="Access-Control-Allow-Credentials" value="true" /> </customHeaders> </httpProtocol> <staticContent> <clientCache cacheControlMaxAge="00:30:00" cacheControlMode="UseMaxAge" /> </staticContent> </system.webServer> </configuration>
%systemroot%\system32\inetsrv\appcmd.exe set config -section:system.webServer/security/requestFiltering /removeServerHeader:true /commit:apphost
To validate the changes, execute the below curl command, and you should not see server details as part of the header.
curl -I https://your-domain.com