Flask / Werkzeug routing - malformed url rule for valid regex

36 views Asked by At

From my understanding, if my Flask app's config has host_matching=True with a static_host also set, then I can pass a host regex string into each route's options in order to get host matching working.

Assuming the above is correct, why would I be getting the following error when trying to match a regular expression which works fine when I use the re module?

    werkzeug/routing/rules.py", line 602, in _parse_rule
        raise ValueError(f"malformed url rule: {rule!r}")
    ValueError: malformed url rule: '(^(?!.*\\.exclude-this-lookahead\\..*)(.*)(?<!\\bexclude-lookbehind-subdomain1)(?<!\\bexclude-lookbehin-subdomain2)\\.(domain1|domain2|domain3)\\.com$)'

Python version: 3.9

Flask version: 2.3.3

Werkzeug version: 2.3.8

0

There are 0 answers