Integrating Jawr with a CDN (CloudFront) - cdn

We're making use of Jawr to bundle javascript and css for a largescale Spring project. One of our requirements is to serve all assets (js, images, css etc) via a CDN (CloudFront).
So far, we've externalised the Jawr working directory to a central S3 bucket and have mapped CloudFront over to top to serve files from this bucket on a sub domain. We now need to tell Jawr to make use of the CDN rather than the Spring controller (and include the cache busting hash).
Has anyone had any experience with this type of configuration? There seems to be a total lack of documentation for Jawr in general and specifically around integrating Jawr with a CDN.
Thanks in advance.

Related

CSS is not linking up and not working with Spring Boot application

This is the the picture of my project.
I have my css file in static/css folder and I am trying to link it with my index.jsp page but it's not working.
NB : Hard refresh, cache clear everything is done and I have tried more than 10 times. :( is there any other way to link up css with spring boot application?
In the Spring-boot documentation you can read where Spring-boot reads static resources by default.
By default Spring Boot will serve static content from a directory
called /static (or /public or /resources or /META-INF/resources) in
the classpath or from the root of the ServletContext. It uses the
ResourceHttpRequestHandler from Spring MVC so you can modify that
behavior by adding your own WebMvcConfigurerAdapter and overriding the
addResourceHandlers method.
If you change the location of your static files to the default one you should be able to reach them by /css/style.css
P.S. here you can find a simple good structured example.
For me now I just put my CSS, JS, images in src/main/resources/static folder and the link is like :
/css/style.css or /js/custom.js
is working fine for spring boot application.
The solution to your problem is very simple, just add to your application.properties file (your configuration file) the next 2 lines of code:
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
this will bust the cache in your browser, and when you'll make changes regarding to static content (like: css files, js files, html files), it will take place.
Spring Boot CSS Showing up blank / not loading after trying everything
Good Luck.

How to connect CDN in magnolia?

I am using Azure CDN, where i have published all my images,css,js files.Now I would like to get all the assets from CDN instead of DAM.
Could you please suggest me?
Thanks in advance.
Actually I would suggest to just add extra step to your publishing process that, when publishing resources from dam will also publish them to azure CDN using their API. Similarly when unpublishing, you remove resources from there too.
You should do that as a first step in publishing, and upon receiving identifier for the resource from CDN, you should store that in assets metadata and only then pass it over to the next publishing step to have dam resource published to your Magnolia public instance.
Then on the public instance, you would need to replace LinkTransformers (and also LinkTransformerManager) and/or maybe just Asset implementation (if you use that exclusively for assets) with a custom implementation that when requesting link to dam asset will use CDN identifier in the assets metadata to construct correct link pointing to the CDN rather than back to Magnolia.
HTH,
Jan
See the Creating a custom content app trail in the documentation - it shows how to integrate images from Flickr, you can customize it to integrate Azure.

Get Static referenced files with http request in meteor

This can be a silly question but I have had some issues with it. I am trying to implement jwplayer with meteor. Jwplayer will try to get a file based off the url you suggest. So I tried to place a file in localhost:3000/test.mp3. When I tried to hit that url I get just the default site. This would work if I used tomcat. Is there something I can do to get the files relative to meteor directory?
Thanks for your help.
In the /public directory, per the docs:
Lastly, the Meteor server will serve any files under the public directory, just like in a Rails or Django project. This is the place for images, favicon.ico, robots.txt, and anything else.
Meteor hasn't yet implemented server side routing and all directories are ultimately flattened. So for the time being, you can access your file at http://localhost:3000/test.mp3, but that may change in the future.

What is the proper way to enable Cloudfront as a Mirroring CDN for my app hosted in EC2

My asp.net mvc site includes folders for JS and CSS files.
What is the proper way to configure cloudfront to cache these files? Should my origin server name just point to
myapp.com
or
myapp.com/scripts
and
myapp.com/css
I only want to cache the static files, not the whole site of course.
you can point your cdn distribution to your custom origin. If you only want to add /css then point to that. If you want to add more than 1 dir, you should either use a proxy or rerwrite rules.

Self-Hosting FontAwesome on S3

I'm trying to self-host FontAwesome (using LESS), but I'd like to serve up the css and webfonts directories from our S3 cloud instead of from the site, for performance reasons. Is this possible? I haven't been successful yet since the css looks for the webfonts directory in a relative location.
Can I create a "Kit" like FontAwesome does with their own CDN? We prefer not to use the FontAwesome CDN for various customization and security reasons.

Resources