Getting the full request URI in the logs before rewrites

The default access logs format uses {uri} to spit out the requested page. If the URL gets rewritten (I’m using fastcgi for PHP and a rewrite, see below) the output in the logs only has the index file without the query/path requested. At a glance, I don’t see what the proper placeholder for this would be.

Logs: - [28/Apr/2017:03:40:24 +0000] "GET /index.php HTTP/2.0" 200 3058

Relevant snippet from my Caddyfile:

fastcgi / php-fpm:9000 php
rewrite {
	to {path} {path}/ /index.php?{query}


I believe {uri} should give you the original request URI, and fastcgi always uses that one to pass upstream. (See - the {rewrite_uri} placeholder should give you the changed URI.

I’m literally working on a change to this right now to go out with the next release; the way we handle the request URI got a bit messy and I’m cleaning it up. I’ll be opening at least one or two pull requests in the next couple days for it! Would love to have your review.

Aha. The problem was in 0.9.5, I hadn’t updated to 0.10.0, my bad. It now shows the correct URI.

Odd thing though, I’ve always had this behaviour, even in my logs dating back to September of last year. Has it been a problem since before then? I was under the impression the problems with the request URIs was a more recent thing based on the issues lately.

I’ll definitely keep an eye and try it out and review when you have something :slight_smile:

Like I said, it’s a mess :wink:

Cleaning it up now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.