#207 open
S. Brent Faulkner

[PATCH] make "internal" domain length configurable

Reported by S. Brent Faulkner | March 25th, 2009 @ 11:32 PM

#128 caused subdomain redirects to be handled internally

it does this by comparing the last two domain components (rather than the entire host name)

there are two problems with this approach...

  1. the current implementation would not work for domain names based off of many of the country tlds... for example, one.foobar.com and two.foobar.com would be recognized as subdomains of a common domain name (and would be redirected internally), while one.foobar.co.nz and two.foobar.co.nz would not

  2. in some test cases subdomains should still be handled separately... in my case, I have multiple applications running on the same domain and do not want the redirect followed when testing

here is a commit that adds a configuration parameter to set the internal_domain_length (which defaults to 2 to preserve current behaviour)...


Comments and changes to this ticket

  • S. Brent Faulkner

    S. Brent Faulkner March 31st, 2009 @ 02:47 PM

    • Tag changed from bug, redirect to bug, patch, redirect
    • Title changed from “make "internal" domain length configurable” to “[PATCH] make "internal" domain length configurable”
  • gaffo

    gaffo May 7th, 2009 @ 06:25 PM

    • Tag changed from bug, patch, redirect to bug, patch, redirect, verify
    • State changed from “new” to “awaiting-merge”

    Need to very but has patch.

  • Bryan Helmkamp

    Bryan Helmkamp June 14th, 2009 @ 09:11 PM

    • State changed from “awaiting-merge” to “open”

    Thanks for the patch Brent. It seems like configuring Webrat's redirect behavior is something people commonly need to do. Instead of pinning this to the internal domain length, what if Webrat just let the user supply a block which would determine if a given URL was considered "internal"?

    I believe this would solve your problem, and also help someone who might have two domains powered by the same application.



  • S. Brent Faulkner

    S. Brent Faulkner June 14th, 2009 @ 09:23 PM

    that would work too, and seems like it would be a more generic way to deal with it.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

Referenced by