Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backreferences are not expanded in E flag #73

Open
kajman-cz opened this issue Jan 24, 2020 · 1 comment
Open

Backreferences are not expanded in E flag #73

kajman-cz opened this issue Jan 24, 2020 · 1 comment

Comments

@kajman-cz
Copy link

Apache documentation says about flag E

VAL may contain backreferences ($N or %N) which are expanded.

But in the tester, neither $N nor %N is expanded.

For url http://example.com/file.php?one=1&two=2&three=3 and rules

RewriteCond %{QUERY_STRING} ^(.*)&(.*)$
RewriteRule ^(.*)$ $1?%1&%2 [E=newqs:%1&%2,N,NE]
RewriteCond %{ENV:newqs} !^$
RewriteRule ^(.*)$ $1?%{ENV:newqs} [R=302,L,NE]

tester returns
http://example.com/file.php?%1&%2

Apache returns
http://example.com/file.php?one=1&two=2&three=3

Note: in my experience, apache requires NE flag only in a redirect, otherwise the default is not escaped, but the documentation does not confirm. In the tester is required NE flag in first RewriteRule too - I'm not sure if it's another tester bug.

@WouterSioen
Copy link
Member

We normally have pretty good consistency with apache for the NE flag (we have a set of rules containing this flag tested both against our app and against apache giving the same result).

We have not implemented the N flag and backreferences inside the E flag yet though.

I'll let you know once we've implemented this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants