diff options
Diffstat (limited to 'doc/vmod-dbrw.3')
-rw-r--r-- | doc/vmod-dbrw.3 | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/doc/vmod-dbrw.3 b/doc/vmod-dbrw.3 index f2ee5fe..8c89cc4 100644 --- a/doc/vmod-dbrw.3 +++ b/doc/vmod-dbrw.3 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>. -.TH VMOD-DBRW 1 "November 12, 2014" "VMOD-DBRW" "User Reference" +.TH VMOD-DBRW 1 "April 21, 2016" "VMOD-DBRW" "User Reference" .SH NAME vmod-dbrw \- Database-driven rewrite rules for Varnish Cache .SH SYNOPSIS @@ -28,8 +28,9 @@ is a Varnish Cache module implementing database-driven rewrite procedures. Its intended use is for web sites that need an exceedingly big number of redirect and/or rewrite rules. .PP -The \fBconfig\fR function should be called upon startup, in \fBsub -vcl_init\fR. It configures the module and supplies it the information +The \fBdbrw.config\fR function should be called exactly once per HTTP session, +before calling \fBdbrw.rewrite\fR (normally it is done from +\fBvcl_recv\fR). It configures the module and supplies it the information necessary for accessing the database and interpreting the data obtained from it. .PP @@ -190,15 +191,12 @@ CREATE TABLE redirects ( VCL 3.0 code: .PP .EX -sub vcl_init { +sub vcl_recv { dbrw.config("mysql", "database=dbname;user=varnish", {"SELECT dest FROM redirects WHERE host='$host' AND url='$url'"}); -} - -sub vcl_recv { set req.http.X-Redirect-To = dbrw.rewrite("host=" + req.http.Host + ";" + "url=" + req.url); |