locked
Troubles with Azure Cdn and Css files. RRS feed

  • Question

  • Having a bit of a misunderstanding with Azure Cdn.
    I have set up an Azure storage account where i have successfully uploaded a few css files from my desktop. I can access those file via origin hostname and review them. I also linked them to my website via origin host name and my website uses them as main css files. 

    After that i've set up a CDN profile with a Cdn EndPoint which i have connected to the Azure Storage account. After a few minutes i was able to access those css files using EndPoint hostname. But when i link these files to my website with EndPoint hostname something strange happens. I get a raw html page and the css file is not applied.

    I've examined what files my web site loads using googlechrome developer tools:

    This is how my website sees my file when i get it from Origin host name. Everything looks fine and it works. My web site looks as i intend it to look ( css is applied) (Can't add a picture of it because my account is not verified). Basically the file is present 

    and html recognizes it as a css.

    This is how my website sees the same css file from the same storage account BUT when i get it from EndPoint host:

    It's completely the same file and website actually loads it BUT Cdn version does not affect the way the website looks. I get a raw html page without any styles from this css file.   (Can't add a picture of it because my account is not verified). 

    Basically the file is present and the contents are completely the same ( it's the same file after all ) but my web site does not want to use it. There are no errors in console connected with any css files.

    Am i doing something wrong?

    Wednesday, September 20, 2017 4:09 PM

Answers

  • Alright, got it. Had to purge my Cdn Endpoint. It has cached my file when it had it's MIME type set to "application/octeet-stream". Basically need to set it to "text/css" and then purge the Endpoint so it gets a fresh version from the storage Account.
    • Marked as answer by Voodoomonkey Thursday, September 21, 2017 5:05 PM
    Thursday, September 21, 2017 5:05 PM

All replies

  • My guess is this is a CORS issue, but I will need to see the headers to confirm.

    Can you please share the URL to your page and CSS assets that you're having problem with?

    Wednesday, September 20, 2017 6:24 PM
  • Hello, thank you for you answer. Unfortunately i cannot share my URL for security reasons. I looked into the headers myself and found an interesting thing.

    When i look at the Myfile.Css loaded from Origin Host name it has : Content-type : text/css. BUT
    When i look at the same file from the same storage account BUT loaded from End Point name i get this : 
    Content-type: application/octet-stream.

    It means that when Cdn sends me my file Mime Type of which i manually set to "text/css" it changes it to the default "application/octeet-stream".

    Any ideas how to change that? 

    Thursday, September 21, 2017 1:32 PM
  • Alright, got it. Had to purge my Cdn Endpoint. It has cached my file when it had it's MIME type set to "application/octeet-stream". Basically need to set it to "text/css" and then purge the Endpoint so it gets a fresh version from the storage Account.
    • Marked as answer by Voodoomonkey Thursday, September 21, 2017 5:05 PM
    Thursday, September 21, 2017 5:05 PM