Configuring AWS Cloudfront for Discourse without Docker

Many of us having trouble with configuring AWS Cloudfront for Discourse.

Here is the solution.

step 1: Create cloudfront distribution with match viewer option.

step 2 : Copy the CDN url to nano config/discourse.conf and uncomment [cdn_url: //copied_cdn_url]

step 3: RAILS_ENV=production bundle exec rake assets:precompile :point_left: run this command . now see the forum all icon and images showing big and collapse.

step 4: Go to cloudfront again and click edit option for forum. again deploy it and i will take all js and css.

step 5 : After completed deployment, check the forum page and you would see the empty page.

step 6: Go to Firefox browser. Type “about:config” and type search box “security.csp.enable” make it true to false. restart the browser.

step 7: Again type forum link on firefox and now you would see the cdn based forum site.

step 8: Login to admin on forum. go to setting → search “content secuirty policy” → add your CDN url on content security policy script src.

step 9: Now restart the discourse “sudo systemctl restart discourse”

step 10: Finally, you see the cdn content’s completely. again enable the security.csp.enable option in firefox. Restart the browser check it if it works. if you see the content without any csp error, you configured properly.

For Complete Reference with Installation Images. Visit this Post on my site: https://venz.ai/configure-aws-cloudfront-in-discourse-without-docker/

I hope you would fix it.

2 Likes

Good share! Hope it helps others.

2 Likes