0

I have added the following configuration in

<httpProtocol>
    <customHeaders>
        <add name="access-control-allow-headers" value="content-type" />
        <add name="Access-Control-Allow-Origin" value="*" />
    </customHeaders>
</httpProtocol>

I am using the following script in an aspx file

 <script type="text/javascript" src="//registeriq.com/js/jquery.min.js"></script>

We have two servers for one web application. one is using http and another using https.

The above script works only on the http server. It does not work on the server with https protocol. Also I am noticing that the system automatically appends https to //registeriq.com/js/jquery.min.js on https server...

Please help me.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • The browser will not like a HTTP request inside a HTTPS connection and will always default to HTTPS when loading additional files unless explicitly stated to use a HTTP connection. In the later case however the browser will display a warning unless there is a security rule set for that domain in the respective browser. – Adwaenyth Nov 12 '15 at 08:13

2 Answers2

0

You're using relative path by using // in:

<script type="text/javascript" src="//registeriq.com/js/jquery.min.js">   </script>

This means the browser automatically prefixes https for your resources when the page is accessed securely (via HTTPS).

By opening https://registeriq.com/js/jquery.min.js in the browser you'll notice that you'll get an error. Meaning it's not being served via HTTPS.

You can use absolute using http, but browsers accessing the page through HTTPs will display a warning.

e.g.

<script type="text/javascript" src="http://registeriq.com/js/jquery.min.js">   </script>

EDIT:

For anyone who find this issue refer to https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content for more information.

In the case above, his app is served via HTTPs but registeriq.com does not have HTTPs.

sanwrit
  • 178
  • 2
  • 12
  • sorry to say that I actually used http:// to the script earlier but https still got appended to it. I think that there is some wrong in .net configuration which i am not able to detect... –  Nov 12 '15 at 09:11
  • In my opinion this is more on the client side (e.g. browser). http://stackoverflow.com/a/8465400/1263580 – sanwrit Nov 12 '15 at 10:00
-2

browsers don't allow putting http link inside https site you can use this ;

<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js">   </script>
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339