Anh Vy Nguyen Vuong

Joined

800 Experience
7 Lessons Completed
0 Questions Solved

Activity

Posted in Turbolinks and jQuery compatibility on Rails 5

Ah I mean inline CSS. For example:
<div class="card-fields hidden"> will be <div class="card-fields" style="display:none">

Posted in Turbolinks and jQuery compatibility on Rails 5

Have you try $(".card-fields").show() instead of $(".card-fields").removeClass("hidden") ?!

In case it fail, don't use class hidden, add in-line style there: style="display:none;". And now $(".card-fields").show() will work.

Posted in How can I setup Cloudfront CDN for Rails App ?!

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 application.rb .
  • 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 !

Posted in How can I setup Cloudfront CDN for Rails App ?!

I added 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

Posted in How can I setup Cloudfront CDN for Rails App ?!

Wow, thanks.
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 ?!

Posted in How can I setup Cloudfront CDN for Rails App ?!

It's good to have CDN enabled to speed up rails app but how can I do that with Cloudfront ?!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.