forked from progrium/nullmq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup redirector and make websocket connection use current hostname
- Loading branch information
1 parent
399de3d
commit 0abbaaf
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "rubygems" | ||
require "bundler/setup" | ||
|
||
require "socket" | ||
|
||
server = TCPServer.new(8888) | ||
private_ipv4 = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address | ||
puts "starting redirector to #{private_ipv4}:8080" | ||
loop do | ||
client = server.accept | ||
headers = "HTTP/1.1 301 Moved\r\nDate: Tue, 14 Dec 2010 10:48:45 GMT\r\nServer: Ruby\r\nLocation: http://#{private_ipv4}:8080/\r\nContent-length: 0\r\n\r\n" | ||
client.puts headers | ||
client.close | ||
end |