Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 117.5k

remove host header vulnerability using url rewrite

May 11 2020 1:30 AM
Hi,
 
My website name is : "http://abcportal.uk.in/xyz_Portal/_layouts/login.aspx"
 
My code in web config is: 
 
<rewrite>
  <rules>
<rule name="Remove Host Header" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern=".*abcportal.uk\.in" />
<add input="{HTTP_HOST}" pattern="www\.abcportal.uk\.in" negate="true" />
</conditions>
<action type="Redirect" url="http://abcportal.uk..in/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
 
But when I call "http://abcportal.uk.in/xyz_Portal/_layouts/login.aspx" it redirects to "http://abcportal.uk.in/"
 
Please help

Answers (1)