Created
June 18, 2012 16:12
-
-
Save hiboma/2949154 to your computer and use it in GitHub Desktop.
sinatra - return requested port (SERVER_PORT)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'sinatra' | |
get '/' do | |
sprintf "%d\n", request.port | |
end |
$ curl http://127.0.0.1:4567/
4567
$ curl -H'Host: example.com' http://127.0.0.1:4567/
80
$ curl -H'Host: example.com:4567' http://127.0.0.1:4567/
4567
it seems to be wrong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now sinatra.rb is listeing on port 4567