1

I am currently using a Microsoft IIS8 server as a reverse proxy for URL rewriting. Currently there is the issue, that i need to set a HTTP Request Header on the IIS. I already went ahead and created a blank rule and set the condition. How do i get IIS to set the current Date and Time in a specific format inside the Request Header? Is that even possible without ASP.NET Websites?

I did not find anything like this while reading through the Microsoft references.

Current state of the rule shows the pattern which the date time should be, the header should be overwritten if it does not match:

 <rule name="set clientDate">
    <match url="(.*)" />
       <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
          <add input="{HTTP_CLIENTDATE}" pattern="[0-9]{4}\-[0-9]{2}\-[0-9]{2}\ [0-9]{2}\:[0-9]{2}\:[0-9]{2}" negate="true" />
       </conditions>
       <action type="None" />
 </rule>

Thanks in advance

lt_katana
  • 11
  • 1
  • 5

1 Answers1

1

You may need to make your own URL rewrite provider.

Here is a sample on how to do so: https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/developing-a-custom-rewrite-provider-for-url-rewrite-module.

milope
  • 441
  • 2
  • 5
  • How does this answer the question? – Michael Hampton Nov 13 '17 at 03:02
  • You have to write a full provider to show it working. One can base off the article and code the part that writes the date header. – milope Nov 13 '17 at 03:07
  • I can't verify this right now since I have currently no time on my hand and the issue was solved on the infrastructure. – lt_katana Nov 14 '17 at 10:24
  • Also a useful resource: [Modifying HTTP Response Headers](https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/modifying-http-response-headers) – Alex Feb 21 '21 at 10:47