1

I'm using WEBAPI (asp.net) with vs2015.

In my web.config I have this rewrite url rule which redirects HTTP to HTTPS (I know I can do it via HSTS but that's not the point here):

 <rewrite>
      <rules>
        <rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
          <match url="(.*)"/>
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true"/>
          </conditions>
          <action redirectType="Temporary" type="Redirect"  url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>

The rule is working fine.

Also , I've created a self signed certificate and made chrome to trust it.

(es.com , is my localhost , via hosts file)

And it is trusted :

enter image description here

But Something is not clear to me.

When I use POSTMAN to make an HTTP request , I get a 307 redirect response header which redirects to HTTPS and it does send the Authorization header , I do see it in my webapi :

enter image description here

Here is the network tab:

enter image description here

The first request was HTTP , then server sends HTTPS redirect and as you can see - WEBAPI did get the Authorization header. Here is the proof that the SECOND request did send the Authorization header :

enter image description here

Now fiddler.

I compose a new request to HTTP :

enter image description here

I do get a response with 307

enter image description here

But the second request doesn't send the authorization header :

enter image description here

And hence - WEBAPI doesn't get its value :

enter image description here

Questions

1 ) Why doesn't fiddler send the Authorization header ? And How can I make it send it

2 ) I think I read somewhere that Authorization headers is NOT being sent on redirects BY DESIGN. If so - does postman is working improperly ?

What am I missing here ?

NB I already know that I can create a custom header which will contain the authorization value , and it will be sent also on redirects. But that's not my question.

Community
  • 1
  • 1
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
  • It is also my understanding that Authorization header should not be preserved during redirects, so if Postman is keeping it I suppose that it is due to some improper implementation. – Darin Dimitrov Jan 09 '17 at 16:38

0 Answers0