I'm currently using the below nginx reverse proxy with sub_filter. This allows me to quickly create a reverse proxy along with a respective CSS filter in realtime.
I can create the equivalent reverse proxy in an IIS URL Rewrite rule relatively easily. However, I have no idea how to also add the respective nginx sub_filter code (shown below) to the reverse proxy I added in IIS. I'm guessing this can be done with URL rewrite outbound rule.
location /files {
proxy_pass http://localhost:999/files;
proxy_set_header Accept-Encoding "";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
sub_filter
'</head>'
'<link rel="stylesheet" type="text/css" href="https://github.io/test/CSS/themes/dark.css"> <style>
.CalendarEvent\/downloaded\/2vSrJ {
background: rgba(39, 194, 76, 0.7) !important;
border-left-color: rgba(39, 194, 76, 0.0) !important;
}</style></head>';
sub_filter_once on;
}
Maybe, I need to add a request filtering rule in IIS? Whatever it is, I have no clue how to do this under IIS. I learn from working examples. If someone can show me what to add specifically to IIS, I'd really appreciate it. Surely there has to be a way to do this in IIS.
PS: I asked on StackOverflow a similar question, in case you would also like to get credit for a StackOverflow answer:
Converting nginx reverse proxy (with sub_filter) to IIS10 URL Rewrite / Request Filtering
Thanks in advance to anyone who can figure out how to do this.
Below, is the current reverse proxy rewrite code I have currently in my web.config:
<rewrite><rules><rule name="Redirect to HTTPS" enabled="false" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTPS}" pattern="^OFF$" /><add input="{REMOTE_ADDR}" pattern="192.168.1.2" negate="true" /></conditions><action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /></rule><rule name="ReverseProxy-FILES" enabled="false" stopProcessing="false"><match url="files\/?(.*)" /><action type="Rewrite" url="http://localhost:999/files/{R:1}" /></rule></rules></rewrite>