Skip to content

Instantly share code, notes, and snippets.

# Put in config/initializers/html_sanitizer.rb
#
# See https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails/html/scrubbers.rb
# for more help on how the PermitScrubber works and the functions you can override.
class CustomScrubber < Rails::Html::PermitScrubber
def initialize
super
puts("CustomScrubber says hi!")
self.tags = %w( script iframe figure figcaption action-text-attachment )
@brianlmoon
brianlmoon / apache_cors_example
Last active November 19, 2023 03:14
CORS example for Apache with multiple domains
# Sets CORS headers for request from example1.com and example2.com pages
# for both SSL and non-SSL
SetEnvIf Origin "^https?://[^/]*(example1|example2)\.com$" ORIGIN=$0
Header set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN
Header set Access-Control-Allow-Credentials "true" env=ORIGIN
# Always set Vary: Origin when it's possible you may send CORS headers
Header merge Vary Origin