https://github.com/mattt/rack-subdomain
Rack middleware to transparently route requests with a subdomain to a specified path with substitutions
https://github.com/mattt/rack-subdomain
Last synced: 9 months ago
JSON representation
Rack middleware to transparently route requests with a subdomain to a specified path with substitutions
- Host: GitHub
- URL: https://github.com/mattt/rack-subdomain
- Owner: mattt
- License: mit
- Created: 2012-05-28T01:06:10.000Z (over 13 years ago)
- Default Branch: main
- Last Pushed: 2021-03-02T19:02:41.000Z (almost 5 years ago)
- Last Synced: 2025-03-28T19:45:07.094Z (10 months ago)
- Language: Ruby
- Size: 18.6 KB
- Stars: 38
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# rack-subdomain
Rack middleware to transparently route requests with a subdomain
to a specified path with substitutions.
## Usage
### Gemfile
```ruby
gem 'rack-subdomain'
```
### config.ru
```ruby
# Simple Example
use Rack::Subdomain, "example.com", to: "/users/:subdomain"
# Complex Example
use Rack::Subdomain, "example.com", except: ['', 'www', 'secure'] do
map 'downloads', to: "/downloads/:subdomain"
map '*', to: "/users/:subdomain"
end
```
## Contact
[Mattt](https://twitter.com/mattt)
## License
rack-subdomain is available under the MIT license.
See the LICENSE file for more info.