{
    "description": "Rewrite URL path to point to the correct URL on the backend. NOT a redirect.",
    "id": "url_rewrites",
    "name": "URL rewrites",
    "properties": [
        {
            "entryTemplate": "{{source}} => {{dest}}",
            "label": "Rules",
            "name": "rules",
            "properties": [
                {
                    "default": "/sitemap.xml",
                    "description": "Incoming URL path only (no host) exact match e.g. /sitemap.xml",
                    "label": "Source path",
                    "name": "source",
                    "required": true,
                    "type": "path"
                },
                {
                    "default": "/media/sitemap.xml",
                    "description": "Destination path on origin (no host)",
                    "label": "Destination path",
                    "name": "dest",
                    "required": true,
                    "type": "string"
                }
            ],
            "type": "group"
        }
    ],
    "test": {
        "origins": [
            "https://httpbin.org"
        ],
        "reqUrl": "/sourcePath"
    },
    "vcl": [
        {
            "template": "{{#each rules}}\nif (req.backend.is_origin && req.url.path == \"{{source}}\") {\n  set bereq.url = \"{{dest}}\";\n}\n{{/each}}",
            "type": "miss"
        },
        {
            "template": "{{#each rules}}\nif (req.backend.is_origin && req.url.path == \"{{source}}\") {\n  set bereq.url = \"{{dest}}\";\n}\n{{/each}}",
            "type": "pass"
        }
    ],
    "version": 1
}
