1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
# ReverseProxy::FormFiller config example
# Put this file somewhere on your server - typically in
# /etc/apache2/FormFiller/ -, adapt it and point to it in Apache2 config,
# through a directive like
# PerlSetVar FormFillerParamFile "<current file path>"
# jQuery selector to the form to fill
# optional: if not defined, first form in web page will be filled
form => '"form:first"',
# may rely on perl functions and Apache environment vars, e.g
#form => '(localtime)[2] >= 12 ? "#morningForm" : "#afternoonForm"',
# If the inputs/textareas/select markups do not belong to any form, you can set
#form => '"body"'
# To enable form auto-submit, or to automatically click on a button
# may be true (enabled), false (disabled), or a jQuery selector to the button to click on
submit => '"true"',
# may also rely on perl functions and Apache environment vars
# optional, default value: false
# URL to load jQuery,
# since ReverseProxy::FormFiller response filter relies on jQuery (any version >= 1.0)
# optional: if not defined, jQuery is supposed to be already loaded in the web page
jQueryUrl => "",
# Form fields to fill in response body - filled data will be seen by user
# Hash keys refer to input/textarea/select's name attribute
# Fields value can rely on perl functions and Apache environment vars
publicFormData => {
company => '"SnakeOilsInc"',
user => '$ENV{REMOTE_USER} =~ /(rtyler|msmith)/ ? "user" : $ENV{REMOTE_USER} =~ /dwho/ ? "admin" : "nobody"',
password => '"hidden"'
},
# Alternatively, if the inputs you want to fill in the html page
# have no name attribute, you can define them with jQuery selectors
#publicFilledData => {
# 'textarea.company' => '"SnakeOilsInc"',
# 'input#user' => '$ENV{REMOTE_USER} =~ /(rtyler|msmith)/ ? "user" : $ENV{REMOTE_USER} =~ /dwho/ ? "admin" : "nobody"',
# 'input[type=password]' => '"hidden"'
#},
# Form fields to fill in request body - filled data will not be seen by user
# Fields value can rely on perl functions and Apache environment vars
# Note that publicFormData are also re-filled in request body,
# to prevent malicious users to tamper them
secretFormData => {
password => '$ENV{REMOTE_USER} =~ /(rtyler|msmith)/ ? "user-secret" : $ENV{REMOTE_USER} =~ /dwho/ ? "admin-secret" : ""',
},
# Alternatively, you can do substitutions on POST data
#postDataSub => [
# 's/foo/bar/',
# 's/user:(.+?):password:[^:]+/user:$1:password:admin-secret/',
#]
# Arbitrary javascript code to run after fields are filled, but before posting the form
# If you call jQuery through its shortcut '$', you have to escape it
# Use single quotes and double quotes as in the following example
# javascript => 'alert("Hello $ENV{REMOTE_USER}"); \$(input.mycheckbox).prop("checked", true)'
|