Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aivarsk/libvmod-rewrite
Varnish vmod for rewriting HTML content.
https://github.com/aivarsk/libvmod-rewrite
Last synced: 16 days ago
JSON representation
Varnish vmod for rewriting HTML content.
- Host: GitHub
- URL: https://github.com/aivarsk/libvmod-rewrite
- Owner: aivarsk
- License: gpl-3.0
- Created: 2013-01-10T21:54:15.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-03T11:50:26.000Z (over 10 years ago)
- Last Synced: 2024-07-31T22:56:19.819Z (3 months ago)
- Language: C
- Homepage:
- Size: 152 KB
- Stars: 18
- Watchers: 7
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: COPYING
Awesome Lists containing this project
README
============
vmod_rewrite
============----------------------
Varnish Rewrite Module
----------------------:Author: Aivars Kalvans
:Date: 2013-01-18
:Version: 0.1
:Manual section: 3SYNOPSIS
========import rewrite;
DESCRIPTION
===========Varnish vmod hack demonstrating how to rewrite HTML content. It's not
production-ready - I'm still learning and looking for the best way how
to do it.Rewrite is performed only once and the rewritten document is stored
in cache.`Buy me a drink!`__
__ https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FUPUJSJ9KCPAL&lc=LV&item_name=libvmod%2drewrite¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
FUNCTIONS
=========rewrite_r
---------Prototype
::rewrite_re(STRING SEARCH_REGEX, STRING REPLACEMENT)
Return value
VOID
Description
Rewrites all parts of document matching SEARCH_REGEX with REPLACEMENTINSTALLATION
============Usage::
./configure VARNISHSRC=DIR [VMODDIR=DIR]
`VARNISHSRC` is the directory of the Varnish source tree for which to
compile your vmod. Both the `VARNISHSRC` and `VARNISHSRC/include`
will be added to the include search paths for your module.Optionally you can also set the vmod install directory by adding
`VMODDIR=DIR` (defaults to the pkg-config discovered directory from your
Varnish installation).Make targets:
* make - builds the vmod
* make install - installs your vmod in `VMODDIR`In your VCL you could then use this vmod along the following lines::
import rewrite;sub vcl_deliver {
rewrite.rewrite_re("https://www.paypal.com/cgi-bin/webscr\?cmd=_donations&business=[^&]+&", "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FUPUJSJ9KCPAL&");
}(No I'm not that evil)
COPYRIGHT
=========See COPYING for details.
* Copyright (c) 2013 Aivars Kalvans