grav: Regex-based routes in site.yaml match but cause 502 error

I am experiencing almost the same error as described by another person recently on Grav Forums.

My relevant site.yaml is:

routes:
  /blog/category/(.*): '/blog?category=$1'

I see “502 Bad Gateway” from nginx and the logs show:

2018/06/30 21:08:42 [error] 1321#0: *1727 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: grav.dev, request: "GET /blog/category/blog HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "grav.dev", referrer: "http://grav.dev/blog/random-thoughts"

I have also tried with a slash after “/blog” before the query. Also tried the regex in single quotes.

This is exactly as documented in Regex based aliases in the docs.

I know the regex is matching because when I tweak it incorrectly I see 404s.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

Please help me how to escape this regex: /yetanother/test/(.*): '/blog?category=$1' I tried '/blog\?category=$1 with no results. Thank you.