Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
foreign-fqdn-routing
Advanced tools
= Foreign FQDN Request Routing
Foreign FQDN Routing provides simple handling of foreign domains in Rails. It borrows largely from SubdomainFu and some other snippets found around the web.
Request routing allows you to define routing conditions that test methods/properties of the request object such as subdomain, domain, port. You can test them either against a value or with a Regexp (assuming the method returns a string)
Merging these two plugins allows them to work together and enhance the routing capability of Rails.
Documentation from the original plugins follows...
Foreign FQDN Routing is available as a plugin or a gem. To install it as a plugin with Rails 2.1 or later):
script/plugin install git://github.com/autodata/foreign-fqdn-routing.git
To install as a gem:
gem install foreign-fqdn-routing
Foreign FQDN Routing extends Rails's routing mechanisms to provide a way to redirect non-native domains.
Let's say my rails app domain is 'mydomain.com' and I am creating an app that allows users to add a CNAME record to map their subdomain so that 'foo.usersdomain.com' would actually point to 'mydomain.com/users/1234'.
The route at the top of config/routes.rb would look like:
map.connect '*path', :controller => 'users', :action => 'index', :conditions => { :foreign_domain => true }
And in the users controller:
@user = User.find_by_foreign_domain(request.host.downcase)
You will need to configure Foreign FQDN Routing based on your native hostnames.
A hash of arrays for the native domain names for each relevant environment.
Create the file config/initializers/native_domains.rb and put something like:
ForeignFQDNRouting.init_native_domains = { :development => ['localhost'], :staging => ['staging.example.com'], :production => ['example.com', 'example.org', 'example.net'] } # set all at once (also the defaults)
Or set the native domains on the fly with:
ForeignFQDNRouting.native_domains = ['example.com', 'example.org', 'example.net'] # sets for current environment
(c) Dan Webb 2006 (dan@vivabit.com)
Plugin that allows you to define routing conditions that test methods/properties of the request object such as subdomain, domain, port. You can test them either against a value or with a Regexp (assuming the method returns a string)
UPDATE Now works with the new routing code as implemented in edge rails. Note the change in API: use :conditions instead of :requirements.
== Installation
ruby script/plugin install http://svn.vivabit.net/external/rubylibs/request_routing/
== Usage
In routes.rb you can specify use the :requirements hash with request properties:
map.connect '', :controller => 'main', :conditions => { :subdomain => 'www' }
map.connect 'admin', :controller => 'admin', :conditions => { :remote_ip => /^127\.0\.0\.[0-9]$/ }
You can also, of course, use the conditions hash in map.with_options calls.
The allowed properties are:
:subdomain (only checks the first subdomain)
:domain (only accurate for single tld domain names at the moment)
:method (a symbol)
:port (a number)
:remote_ip
:content_type (content type of the post body)
:accepts
:request_uri (the entire request uri)
:protocol (either http:// or https://)
== Copyright
Copyright (c) 2009 Joe Scharf. See LICENSE for details.
FAQs
Unknown package
We found that foreign-fqdn-routing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.