Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Automatically insert 'http://' if needed.

  • Loading branch information...
commit 05e6ffcb2f9a2669a8fa1bde9b755857814265e8 1 parent 26b5340
Caleb Spare authored
Showing with 11 additions and 3 deletions.
  1. +9 −1 bin/ez-nginx-proxy
  2. +2 −2 example_config.rb
10 bin/ez-nginx-proxy
View
@@ -21,7 +21,7 @@ options = Trollop.options do
[
["/foo/bar", "localhost:1234"], # Route requests to /foo/bar to a local server
- ["/", "amazon.com"] # / matches every request
+ ["/", "amazon.com"] # / matches every request
]
Usage:
@@ -76,6 +76,14 @@ unless match && match.size == 2
end
config_dir = File.dirname(match[1])
+routes.map! do |pattern, target|
+ if target =~ %r{://}
+ [pattern, target]
+ else
+ [pattern, "http://#{target}"]
+ end
+end
+
routes.each do |pattern, target|
puts "Proxying `#{pattern}` to #{target}".green
end
4 example_config.rb
View
@@ -1,4 +1,4 @@
[
- ["/foo/bar", "http://localhost:1234"],
- ["/", "http://localhost:5678"]
+ ["/foo/bar", "localhost:1234"],
+ ["/", "localhost:5678"]
]
Please sign in to comment.
Something went wrong with that request. Please try again.