For my Controlling USB on Raspberry Pi project I set up a tunnel using ngrok and had an HTTP listener on the Raspberry Pi using HTTP::Server::Simple. It works very well...
Here is the bit that handles the HTTP requests...
package Bod::Curtains::Server;
VERSION = 1.0
use HTTP::Server::Simple::CGI;
use base qw(HTTP::Server::Simple::CGI);
use Bod::Curtains::Control;
use HTTP::Tiny;
use Sys::Hostname;
use strict;
my $control = Bod::Curtains::Control->new;
my $host = hostname;
sub handle_request {
my ($self, $request) = @_;
print "HTTP/1.0 200 OK\r\n";
print $request->header;
print "SUCCESS\n";
}