Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Toadfarm::Manual::ConfUser)Contributed Perl DocumenToadfarm::Manual::Config(3)

       Toadfarm::Manual::Config	- Config format	for Toadfarm apps

       This manual gives in-depth information about the	config options that
       can be given to an application.

       The basic structure of the application is shown below. This document
       covers the %config part given to	"mount"	in Toadfarm::Manual::DSL.

	 use Toadfarm -init;
	 mount "MyApp" => \%config;

       The mount function is used to define the	available apps that Toadfarm
       should serve.

       The %config is either HTTP headers to trigger on	or "Special fields".

       The config example below	contain	all the	special	fields that you	can
       use and a list of example headers to filter on. Each key	(except
       "config") is used to filter the incoming	request, and ALL the specified
       values must match for the request to get	passed on to a given

	 mount "Some::Application" => {

	   # headers
	   "Host"	    => qr{^(www.)?$},
	   "User-Agent"	    => qr{curl},
	   "X-Request-Base" => "",

	   # special fields
	   config	  => {some_key => "value"},
	   local_port	  => 8080,
	   mount_point	  => "/myapp",
	   remote_address => "",

       Example HTTP request that will get sent to "Some::Application":

	 -- Connect (
	 -- Client >>> Server (
	 GET /myapp HTTP/1.1
	 Connection: keep-alive
	 Content-Length: 0
	 Accept-Encoding: gzip
	 User-Agent: curl/7.32.0

       So if "User-Agent" is "Mojolicious (Perl)" instead, but all the other
       headers match, then the request will NOT	be passed on to

       Got difficulties	getting	a request through to an	application? Try
       removing	rules until the	request	gets through.

       Special fields

       Fields that are defined in the list below are special fields.

       o   config => \%hash

	   This	config param will override any config parameters already known
	   in the target application. It will also generate a temporary	config
	   file	which is available as
	   "MOJO_CONFIG|Mojolicious::Plugin::Config/file" to the target

	   Note: These config params are set after startup() is	called.	(This
	   will	hopefully be changed/fixed in future release of	Toadfarm)

       o   local_port => $str|$regex

	   Used	to only	accept requests	on a given port	access.

       o   mount_point => $str

	   The default mount point is "/". Setting this	to "/foo" will only
	   make	the application	accessible under "".

       o   remote_address => $str|$regex

	   Used	to only	accept from a given address access.

       o   X-Request-Base => $str

	   This	header will also set request base url when this	rule match.
	   This	is the same funtionality that is provided by

       Additional special fields might be added, but they will always be in
       lower case.

       Jan Henning Thorsen - ""

perl v5.32.0			  2015-10-01	   Toadfarm::Manual::Config(3)


Want to link to this manual page? Use this URL:

home | help