Send an HTTP OPTIONS request

Google Translate started sending my website "OPTIONS" requests recently. I wanted to check what response it made, so I made the following based on the Stack Overflow post mentioned.

use warnings;
use strict;
use HTTP::Request;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new ();
my $request = HTTP::Request->new (OPTIONS => '');
my $response = $ua->request ($request);
print $response->as_string (), "\n";


As of October 2016, my site returns something like this:

HTTP/1.1 200 OK
Connection: close
Date: Mon, 10 Oct 2016 00:20:34 GMT
Via: 1.1 (squid/2.7.STABLE7)
Server: Apache
Content-Length: 1
Content-Type: text/plain; charset=UTF-8
Client-Date: Mon, 10 Oct 2016 00:20:35 GMT
Client-Response-Num: 1

Web links

Copyright © Ben Bullock 2009-2023. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( or use the discussion group at Google Groups. / Privacy / Disclaimer