Skip to content

Commit

Permalink
Send a Host: header with the purge request
Browse files Browse the repository at this point in the history
This allows a setup whereby your .varnishrc specifies a hostname or IP
different to the hostname you're purging; the request will be made to
the Varnish server, but the ban will have the correct hostname.
  • Loading branch information
robmiller committed Oct 14, 2014
1 parent 50fdc36 commit 2f46d19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/varnisher/purger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def send

begin
http = Net::HTTP.new(hostname, port)
response = http.request(@request_method.new(@path))
request = @request_method.new(@path)
request.add_field("Host", @host)
response = http.request(request)
rescue Timeout::Error
return false
end
Expand Down

0 comments on commit 2f46d19

Please sign in to comment.