lundi 5 janvier 2015

using AWS rewrite rule and iis express

I have a rewrite rule in web.config which help me to redirect request that are coming from ELB in AWS to https.



<rewrite>
<rules>
<rule name="Force Https" stopProcessing="true">
<match url="healthcheck.html" negate="true" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}" redirectType="Permanent" appendQueryString="true"/>
</rule>
</rules>
</rewrite>


for developing If i use "visual studio development server" option, when I run the program it works fine.


project debug properties


but the application is getting bigger and slower to debug, in some cases have to wait 5 to 10 min to a single page loads. So thought it's better to use IIS Express.


But the problem is if i use IIS express then it doesn't load the default.aspx, give error about ssl. I already enabled the ssl for the site, so the port set as follow.


project properties windows


When I manually type http://localhost:20348. the browser redirect it to https://localhost:20348 and as you can see the port is not correct


if I manually type https url (https://localhost:44300) then it give redirect loop error.


If i comment the rewrite rule then I can simply debug my website in iis express.


Questions


1- Is there any solution to bind both http and https in visual studio to the same port?


2- Is there any better way than commenting the rewrite rule each time that doesn't ruin AWS ELB rule?





Aucun commentaire:

Enregistrer un commentaire