Ah I mean inline CSS. For example:
<div class="card-fields hidden"> will be
<div class="card-fields" style="display:none">
Have you try
$(".card-fields").show() instead of
In case it fail, don't use class
hidden, add in-line style there:
style="display:none;". And now
$(".card-fields").show() will work.
I sovled it by combining many methods such as:
- Add custom header to Cloudfront Origin (Done in dashboard)
- Add Nginx Mimes types and add header forward there (Done in server block of Nginx config file)
- Add rack-cors and put your snippet it in
- Enable serving static assets
config.serve_static_assets = true
- Clear cloudfront cache by creating
Invalidation(Done in dashboard)
Not sure which one make impact, but it's urgent so I'll try one by one next times. Btw. thanks for your support Chris !
rack-cors as your recommendation but didn't work. :(
FYI: This app using Rails 4.
And I also found this article: https://ricostacruz.com/til/rails-and-cloudfront He mentioned all step there
I tried and it's really easy to setup. But I have some error with this: "Access to Font .. has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource..."
Do you have any idea to resovle this ?!
It's good to have CDN enabled to speed up rails app but how can I do that with Cloudfront ?!