Running http resources over https page

Chetan Sharma asked on April 30, 2014 07:42

Hello All,

On my website we have a secure page(only secure page). This page is inheriting CSS/javascripts from the master template. We run into this problem in chrome while accessing non-secure content over https. Other browsers are working fine.

  1. What is the correct way to access resource like below over https?

  2. How will I define protocol-less relative paths for my CSS which are written like this

~/App_Themes/Website/images/icons-s1880c32850.png

  1. We have only one CSS in the website and is linked to master template via template properties. How will be able to change path for that?

  2. If I enable https to YES in template properties -> Security, chrome throws loop detected error.

Any pointers on these?

Regards, Chetan

Recent Answers


Chetan Sharma answered on April 30, 2014 07:43

Resources written like these

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 30, 2014 07:44

< src="/CMSPages/GetResource.ashx?scriptfile=/CMSScripts/custom/vendor/modernizr.js">

**Script tag removed here purposely **

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 30, 2014 09:59

You shouldn't have any problems with any of those URLs. They will automatically detect the domain and protocol, thats the beauty of the CMS. Now if you link to external sites like Google API or jQuery library, you will simply use <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 30, 2014 10:10

Hi Brenden,

Appreciate your reply!! If what you said above is true, then I am afraid this is not happening.

Is this not happening because of this http://devnet.kentico.com/articles/ssl-css-protocols-when-using-a-load-balanced-web-farm

Regards Chetan

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 30, 2014 10:12

Just an update this problem is occuring on all browsers

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 30, 2014 11:36

I've got a site running in a load balanced web farm with 2 servers in the farm and have no issues with SSL or links at all. And no code was modified as suggested in that article. Straight out of the box. I always use the CSS Module for stylesheets, I very rarely use a stylesheet in the file system. I always use ../../App_Themes/SiteCodeName/images/image.png as a URL, same for font references in my stylesheets.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 30, 2014 11:54

We are also using this exactly the way you have suggested. I don't see from where this problem is creeping in.

BTW what do you mean by CSS module? How do you refer to CSS in this case. Can you provide one example each for css and javascript.?

Thanks Chetan

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 30, 2014 13:13

CSS Module = Site Manager>Development CSS Stylesheets. I create a new stylesheet for the site and assign that in the Site Manager>Sites module. Then if I have another stylesheet say for instance a slider plugin, I'll create another stylesheet and add it to the page using the HEAD HTML webpart and adding this in the code <link href="/CMSPages/GetResource.ashx?stylesheetname=MySiteSlider" type="text/css" rel="stylesheet"/> .

The stylesheet has something like this for a font import:

@font-face {
font-family: 'montserratbold';
src: url('../../App_Themes/MySite/fonts/montserrat-bold-webfont.eot');
src: url('../../App_Themes/MySite/fonts/montserrat-bold-webfont.eot?#iefix') format('embedded-opentype'),
     url('../../App_Themes/MySite/fonts/montserrat-bold-webfont.woff') format('woff'),
     url('../../App_Themes/MySite/fonts/montserrat-bold-webfont.ttf') format('truetype'),
     url('../../App_Themes/MySite/fonts/montserrat-bold-webfont.svg#montserratbold') format('svg');
font-weight: normal;
font-style: normal;

}

Here is an example of an image in CSS, again working without issue:

background: url("../../App_Themes/MySite/images/logoMobile.png") left top no-repeat;

An example of calling a custom js file:

<script src="/CMSPages/GetResource.ashx?scriptfile=/CMSScripts/Custom/MySite/jquery.watermark.min.js" type="text/javascript"></script>

On your load balancer, is it set to leave the user on the same server until their session ends? Or are they jumping back and forth between servers? I've set this particular setup to leave them on the one server until their session ends. Could be an issue, who knows.

What does your CSS and HTML look like? Maybe that needs to change. I'm almost positive its a problem with the load balancer setup.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 30, 2014 16:53

Brenden,

What settings do I need to make sure to have on load balancer? Any pointers.

I am using other resources exactly the way you do. Thanks for the detailed example.

Best regards Chetan

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 1, 2014 11:26

Unfortunately, I don't know those, the network folks set those up after I complained things weren't working.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.