Search code examples
ruby-on-railsfont-awesome-5

Rails 5.2.x, updated to a FontAwesome kit from CDN - what do I need to add to my CSP to allow css and fonts?


For anyone who is updating their FontAwesome from CDN to kit (free version), a couple of things I found useful when updating. Be sure to update your CSP with the following:

  • add your kit src url to CSP_DIRECTIVE_SCRIPT_SRC
  • add https://kit-free.fontawesome.com to your CSP_DIRECTIVE_FONT_SRC
  • add https://kit-free.fontawesome.com/releases/latest/css/free.min.css to your CSP_DIRECTIVE_STYLE_SRC

Solution

  • add your kit src url to CSP_DIRECTIVE_SCRIPT_SRC add https://kit-free.fontawesome.com to your CSP_DIRECTIVE_FONT_SRC add https://kit-free.fontawesome.com/releases/latest/css/free.min.css to your CSP_DIRECTIVE_STYLE_SRC