Code Monkey home page Code Monkey logo

Comments (3)

 avatar commented on September 18, 2024 1

Workaround

Use regex replace to set the request path without turning it into an empty string:

    actions:
      req_path:
        - replace:
            from_regex: /mypath/?(.*)
            to_regsub: /\1

from orm.

 avatar commented on September 18, 2024

Available workaround

Below does not work in this case as the problem is that the path rewrite leaves an empty string. See below comment for a working req_path action.

Use a separate exact match to handle the problematic case explicitly:

from orm.

splushii avatar splushii commented on September 18, 2024

The root cause for the behaviour in this specific case is a rule on the form:

  - description: A VCL_Error generating rule
    domains:
      - example.com
    matches:
      all:
        - paths:
            begins_with:
              - "/path"
    actions:
      backend:
        origin: https://some.domain.example.com
      req_path:
        - prefix:
            remove: '/path'

A request to https://example.com/path makes the variable path in Varnish to "" and later there will be a set req.url = variable.get("path"); which is not allowed because it triggers

--  VCL_Error      Setting req.url to empty string

So to fix this there needs to be some check for the empty string in the path variable. Something like

if (variable.get("path") != "") {
  set req.url = variable.get("path");
} else {
  set req.url = "/";
}

from orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.