{"id":18439953,"url":"https://github.com/varnishcache/libvmod-example","last_synced_at":"2026-01-30T20:32:12.153Z","repository":{"id":47453219,"uuid":"66359380","full_name":"varnishcache/libvmod-example","owner":"varnishcache","description":"Starting point for vmod development for Varnish Cache","archived":false,"fork":false,"pushed_at":"2021-08-31T05:58:05.000Z","size":116,"stargazers_count":13,"open_issues_count":1,"forks_count":13,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-06-16T13:12:27.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"M4","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varnishcache.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-23T11:01:16.000Z","updated_at":"2023-12-12T05:53:53.000Z","dependencies_parsed_at":"2022-09-07T02:01:31.685Z","dependency_job_id":null,"html_url":"https://github.com/varnishcache/libvmod-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/varnishcache/libvmod-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnishcache%2Flibvmod-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnishcache%2Flibvmod-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnishcache%2Flibvmod-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnishcache%2Flibvmod-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varnishcache","download_url":"https://codeload.github.com/varnishcache/libvmod-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnishcache%2Flibvmod-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28918451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T20:25:28.696Z","status":"ssl_error","status_checked_at":"2026-01-30T20:25:13.426Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T06:27:27.827Z","updated_at":"2026-01-30T20:32:12.132Z","avatar_url":"https://github.com/varnishcache.png","language":"M4","funding_links":[],"categories":[],"sub_categories":[],"readme":"============\nvmod-example\n============\n\nnotice\n------\n\nFor new developments, we recommend to consider using\nhttps://github.com/Dridi/vcdk\n\nSYNOPSIS\n========\n\nimport example;\n\nDESCRIPTION\n===========\n\nExample Varnish vmod demonstrating how to write an out-of-tree Varnish vmod.\n\nImplements the traditional Hello World as a vmod.\n\nFUNCTIONS\n=========\n\nhello\n-----\n\nPrototype\n        ::\n\n                hello(STRING S)\nReturn value\n\tSTRING\nDescription\n\tReturns \"Hello, \" prepended to S\nExample\n        ::\n\n                set resp.http.hello = example.hello(\"World\");\n\nINSTALLATION\n============\n\nThe source tree is based on autotools to configure the building, and\ndoes also have the necessary bits in place to do functional unit tests\nusing the ``varnishtest`` tool.\n\nBuilding requires the Varnish header files and uses pkg-config to find\nthe necessary paths.\n\nUsage::\n\n ./autogen.sh\n ./configure\n\nIf you have installed Varnish to a non-standard directory, call\n``autogen.sh`` and ``configure`` with ``PKG_CONFIG_PATH`` pointing to\nthe appropriate path. For instance, when varnishd configure was called\nwith ``--prefix=$PREFIX``, use\n\n::\n\n export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig\n export ACLOCAL_PATH=${PREFIX}/share/aclocal\n\nThe module will inherit its prefix from Varnish, unless you specify a\ndifferent ``--prefix`` when running the ``configure`` script for this\nmodule.\n\nMake targets:\n\n* make - builds the vmod.\n* make install - installs your vmod.\n* make check - runs the unit tests in ``src/tests/*.vtc``.\n* make distcheck - run check and prepare a tarball of the vmod.\n\nIf you build a dist tarball, you don't need any of the autotools or\npkg-config. You can build the module simply by running::\n\n ./configure\n make\n\nInstallation directories\n------------------------\n\nBy default, the vmod ``configure`` script installs the built vmod in the\ndirectory relevant to the prefix. The vmod installation directory can be\noverridden by passing the ``vmoddir`` variable to ``make install``.\n\nUSAGE\n=====\n\nIn your VCL you could then use this vmod along the following lines::\n\n        import example;\n\n        sub vcl_deliver {\n                # This sets resp.http.hello to \"Hello, World\"\n                set resp.http.hello = example.hello(\"World\");\n        }\n\nCOMMON PROBLEMS\n===============\n\n* configure: error: Need varnish.m4 -- see README.rst\n\n  Check whether ``PKG_CONFIG_PATH`` and ``ACLOCAL_PATH`` were set correctly\n  before calling ``autogen.sh`` and ``configure``\n\n* Incompatibilities with different Varnish Cache versions\n\n  Make sure you build this vmod against its correspondent Varnish Cache version.\n  For instance, to build against Varnish Cache 4.1, this vmod must be built from\n  branch 4.1.\n\nSTART YOUR OWN VMOD\n===================\n\nThe basic steps to start a new vmod from this example are::\n\n  name=myvmod\n  git clone libvmod-example libvmod-$name\n  cd libvmod-$name\n  ./rename-vmod-script $name\n\nand follow the instructions output by rename-vmod-script\n\n.. image:: https://circleci.com/gh/varnishcache/libvmod-example/tree/master.svg?style=svg\n    :target: https://app.circleci.com/pipelines/github/varnishcache/libvmod-example?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarnishcache%2Flibvmod-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarnishcache%2Flibvmod-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarnishcache%2Flibvmod-example/lists"}