Short version: Can you change req.url in vcl_log before actually doing any of the logging? I thought you could, and I don't get an error when I try, but it doesn't seem to have any effect either.
Background: For complicated historical reasons, our logic flow for 404s is like this:
- Original request comes in
- Request gets sent to origin.
- 404 is returned from origin.
- req.url is rewritten to be like req.url = "/my404page"
- restart; is called.
- The request, now with req.url = "/my404page", goes to the origin, appropriate content is returned, and the content is served to the user with status 404.
- vcl_log is called and logging is done.
But because we rewrote req.url in step 4, what gets logged is a request for "/my404page", which is not useful because now every single request that 404s looks exactly the same. I would like to see the original URL.
I thought I could do something like "3.5 set req.http.x-original-url = req.url", and then "6.5 set req.url = req.http.x-original-url", but it does not seem to have any effect at all, as though req.url were immutable in vcl_log. Any suggestions?
Please sign in to leave a comment.