How IE9 handles caching of redirects, fonts, CDN HTTP headers, and cross-domain resource sharing (CORS)

After thinking I had found a solution to the tricky issue of Firefox and CDN-hosted font access, Internet Explorer 9 proved otherwise.

An infuriating caching problem with IE9 led me to a blog post titled "IE9 Redirect Caching Nightmare," shedding light on the real issue at hand.

While uncertain if this directly relates to my problem, it certainly seems like a close match.

The Issue:

I have a website configured with two domains (base domain and subdomain) pointing to the same server. Both domains load the exact same content from a CDN hosted on Amazon S3 via Cloudfront.

https://example.com
https://www.example.com

Upon inspecting the IE9 developer tools console, I encountered error messages when trying to load fonts from my CSS file using @font-face:

CSS3117: @font-face failed cross-origin request. Resource access is restricted.

This error popped up when visiting one URL first and then accessing the other. It's important to note that IE9 was not in Compatibility Mode but running in Document Mode: IE9 Standards.

My understanding of CORS and setting Access-Control-Allow-Origin HTTP header led me to configure it in the S3 CORS policy. While this worked seamlessly with Firefox, IE9 seemed to cache the redirect along with the Access-Control-Allow-Origin header, causing the discrepancy between domains.

Further investigation revealed similar behavior in Firefox 19, albeit less strict than IE9. Chrome, on the other hand, displayed different behavior altogether. This disparity leaves me questioning which browser's implementation is correct.

Despite current settings rerouting all www subdomain requests to the main domain for Chrome and Firefox, addressing the IE9 caching issue remains a challenge.

Potential Solutions:

  1. Allow all domains by setting Access-Control-Allow-Origin header to *
  2. Disable browser caching
  3. Redirect one domain to the other
  4. Use query string to differentiate domain calls for resources
  5. Embed fonts into CSS as data-uri

Option 1 feels overly broad, while option 2 may not be feasible considering mobile device usage. Redirecting domains or dynamically regenerating CSS for different domains incur their own complications.

Question: How can we specifically address IE9's redirect caching behavior in this scenario?

Any insights or suggestions would be greatly appreciated. Thank you!

Edit: Additional browser test findings.

Answer №1

Solution 1: Visit this link for more information.

Solution 4: Change the file extension of your CSS file to style.php and incorporate the necessary code to access the correct resource.

Ensure that you specify the content type at the beginning of the page.

<?php
    header("Content-type: text/css; charset: UTF-8");
?>

For additional details about style.php, check out this article by Chris Coyier from CSS-Tricks.

Answer №2

We encountered a similar strange issue in both IE10 and IE11.

Clearing the browser cache resolves the font loading problem, as does toggling compatibility mode on and off.

However, when navigating to a different subdomain, IE fails to display the font due to mismatched request and response headers retaining the URL of the previous request. Even though the domain is set to *.ourdomain.com, IE stubbornly displays the full URL.

To address the challenge of cross-origin requests for webfonts, we added CORS permissions to the S3 Bucket, successfully resolving the issue in Firefox.

Despite this solution, we are still puzzled about how to prevent IE from caching response headers using *.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to access the 'hidden' property for a div using crispy forms?

I am trying to figure out how to make 'hidden' a property of a div in my HTML: <div class="some-class" hidden> <input id="field1"....... form stuff> </div> If I have a form set up like this: class SomeForm(forms.ModelForm ...

Achieving equal height in Bootstrap columns

Artwork Hey everyone, I'm facing a small dilemma. Currently, I am tackling a project with a unique design. Within the layout of this project, there is an image section that is causing some trouble for me. I am aiming to create a portion of the webs ...

Ways to create space between the columns in a bootstrap carousel with multiple items and the previous and next buttons

I'm currently utilizing Bootstrap 4 and have created a multiple item carousel as shown in the image below: https://i.sstatic.net/NbO7u.png While the carousel is functioning properly, I'm facing the issue of not being able to add spacing between ...

Tips for alternating the display between parent and child elements using jQuery

I am working with a list that includes parent and children items. Title1 child1 child2 child3 Title2 child1 child2 child3 My goal is to display the parent and children in the following format: title1_child1 title1_child2 title1_child3 title2_chil ...

What are some ways to improve the appearance of a bootstrap styled button text to make it look cleaner and more polished

I think there is room for improvement here. When you look at the js fiddle, the text appears blurry and not as polished as it could be. Any suggestions on how to make the text sharper and more professional? Would using @font face to import fonts help? And ...

The background image fails to fill the entire page

I am facing a strange issue with a website. The background image does not cover the entire page, leaving large white sections when I resize the window. Oddly enough, this problem only occurs on certain PCs or laptops. After asking several friends to test t ...

Can a file name be designated within a .zip archive while compressing standard input to standard output using command line tools?

I need to figure out how to specify a file name within a compressed .zip archive while compressing it from standard input to standard output without generating a temporary file in the process. My current approach involves using a script that creates a mys ...

increasing the SQL integer value with padding

Is it possible to apply padding to certain INT return values retrieved from an SQL database using CSS within a div tag? I need specific numbers to have padding-left: 20px; while other specific numbers should have padding-right: 20px;. This presents a styl ...

Is it possible to overlay color on top of a div background? (i.e. modify div color without altering the 'background-color' property)

Can you apply a color "on top of" a div's background? I'm looking to change the displayed color of a div without altering the 'background-color' value. I need to keep the background-color for comparison when divs are clicked: var pick ...

One cannot adjust the opacity of the arrow in ionic 4 ion-item details

Currently, I am dealing with a project that was not originally coded by me and have come across an issue that is proving to be challenging to resolve. Please review the code snippet below: <ion-item detail *ngIf="c.cv" [routerLink]="[&ap ...

Changing the color of placeholder text with CSS on Squarespace

I'm having a tough time figuring out how to adjust the color of the placeholder text in my form fields. Despite being able to change the background color of the form fields, I can't seem to alter the text color. The placeholder text doesn' ...

Hidden menu does not work with Jquery

As I work on creating a responsive website, I am faced with the challenge of implementing a menu that only opens on mobile devices when clicked. I came across some code on Stackoverflow that I thought would solve this issue for me. However, I seem to be en ...

What is the best way to integrate LESS css into a Reactjs application?

I am looking to incorporate LESS into my React app, but I have been unsuccessful in finding a solution through Google. As a newcomer to ReactJs, I lack deep knowledge and would greatly appreciate guidance on installing Less. If anyone is able to help me ...

At times, receiving text is possible, but occasionally the message "Element cannot be located with provided selector" may appear

When using var n = I.Find(("#CSS_path"); to locate an element and click on it, I encountered a problem when attempting to compare the text inside. Initially, I tried using var nt = n.Element.Text; and string name = n.Element.ToString(); to retrieve the tex ...

Modifying the appearance of scoped child components in Vue: A step-by-step guide

I am currently using vant ui components in my Vue project, such as buttons. I would like to make some minor style adjustments, like changing the color and border, but I am unsure how to do it. Can anybody please assist me in solving this issue? Thank you i ...

Error with column arrangement: absolute-positioned elements are displaying in the incorrect column

I'm currently trying to implement masonry layout using the CSS property column-count. While I am aware that there are simpler solutions involving creating multiple columns for the masonry structure, the complexity of my project built on PHP Laravel li ...

Overlaying a parent container DIV on top of its child elements

My JavaScript scrolling view is quite intricate, enclosed within a DIV. The elements inside have event handlers for mouseover and mouseout to manage the scrolling behavior, as well as clickable links. Currently, I am in need of a semi-transparent image th ...

Incorrect Alignment of Centered Boxes with CSS

I'm having trouble creating centered boxes with CSS. Currently, I have the following code: http://jsfiddle.net/LW7mN/2/ .trex-clear-all{ display: inline-block; width: 99%; height: 17px; font-size: 12px !important; text-align: -w ...

Tips for creating space between flex columns without causing content to overflow

I am struggling with a simple 2-column flex setup where I want to add some margins between the columns. However, when I try to do this, the second column ends up overflowing outside of the .flex-row container. This issue becomes more prominent when I inclu ...

Can we not customize a nested component using the 'styled()' function in MUI?

Looking at the code snippet below, my attempt to style an MUI Stack component within an MUI Dialog component seems to be falling short. The Stack styles are not being applied as expected: const CustomDialog = styled(Dialog)(({ theme }) => ({ ' ...