Search code examples
javascriptwordpressazure-web-app-serviceazure-cdn

Fail to include js files in Azure CDN, origin is WordPress


I'm running an Azure Website with Wordpress. I am running Azure CDN for that website to speed up things, and this works fine for css and image files. But my js files do not seem to be in the CDN.

On the WordPress side, I am using WP Super Cache to configure it, and including the directories wp-content and wp-includes.

Neither of these two exist if I go to the CDN url for the files, which is why I get a 404 on them when running the website.

/wp-includes/js/jquery/jquery.js?ver=1.12.4 
/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1 

I suspect it may have to do with the parameters, but cannot figure out how to solve it.

Any ideas? Thanks!


Solution

  • It turned out that not providing an "Origin host header" in Azure CDN was the problem. The Origin host header was set to the same as the origin hostname. Note that this only gave problems for .js files, not images or css.