Skip to content

Instantly share code, notes, and snippets.

View RouL's full-sized avatar

Markus Zhang RouL

  • Deutscher Paritätischer Wohlfahrtsverband Landesverband NRW
  • Gevelsberg
View GitHub Profile
@RouL
RouL / host_based_tld_length.rb
Created June 21, 2017 13:11 — forked from toolmantim/host_based_tld_length.rb
Reconfigures Rails ActionDispatch's TLD handling dynamically based on the request host, so you don't have to mess with config.action_dispatch.tld_length for cross-device testing using xip.io and friends
# Reconfigures ActionDispatch's TLD handling dynamically based on the request
# host, so you don't have to mess with config.action_dispatch.tld_length for
# cross-device testing using xip.io and friends
#
# Examples:
# use Rack::HostBasedTldLength, /xip\.io/, 5
class Rack::HostBasedTldLength
def initialize(app, host_pattern, host_tld_length)
@app = app