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

rewriteRule when relative is malfunctioning when depth greater than 1 #118

Open
gpickin opened this issue Apr 2, 2018 · 1 comment
Open

Comments

@gpickin
Copy link

gpickin commented Apr 2, 2018

Rewrites are getting confused from rewrite match to lucee request being executed.
Same rewrites work on Apache

With the following rule.
RewriteRule ^(.*)$ index.cfm%{REQUEST_URI} [QSA,L,NS]

Hitting a url of /cbadmin is rewritten as /index.cfm/cbadmin correctly

Hitting a url of /cbadmin/foo is matched by the rules and says its rewriting as /index.cfm/cbadmin/foo
The actual request is hitting Lucee as:
/cbadmin/index.cfm/cbadmin/foo

If the rewrite is set as /index.cfm it will work because if that leading slash is missing, some code somewhere is making it relative to the "folder" it thinks it's in.

This works RewriteRule ^(.*)$ /index.cfm%{REQUEST_URI} [QSA,L,NS]
But only if you aren't using a subfolder.

If you have /app/index.cfm and you hit /app/cbadmin/ it would fail if you have the rule with /index.cfm

@gpickin
Copy link
Author

gpickin commented May 4, 2018

with this rule: RewriteRule ^(.*)$ index.cfm%{REQUEST_URI} [QSA,L,NS]
hitting this url - http://127.0.0.1:53575/app/monkey/lion/tiger
I see this error

[DEBUG] requested: '/app/monkey/lion/tiger'
[DEBUG] urlrewrite.UrlRewriter: processing request for /app/monkey/lion/tiger
[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to index.cfm/app/monkey/lion/tiger
[DEBUG] urlrewrite.UrlRewriter: rule is last
[WARN ] responded: Status Code 404 (/app/monkey/lion/index.cfm)

if i have the trailing / like http://127.0.0.1:53575/app/monkey/lion/tiger/
then i see this error

[DEBUG] requested: '/app/monkey/lion/tiger/'
[DEBUG] urlrewrite.UrlRewriter: processing request for /app/monkey/lion/tiger/
[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to index.cfm/app/monkey/lion/tiger/
[DEBUG] urlrewrite.UrlRewriter: rule is last
[WARN ] responded: Status Code 404 (/app/monkey/lion/tiger/index.cfm)

If i make the rule have a slash RewriteRule ^(.*)$ /index.cfm%{REQUEST_URI} [QSA,L,NS] then it works from the base.

[DEBUG] requested: '/app/monkey/lion/tiger/'
[DEBUG] urlrewrite.UrlRewriter: processing request for /app/monkey/lion/tiger/
[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to /index.cfm/app/monkey/lion/tiger/
[DEBUG] urlrewrite.UrlRewriter: rule is last

Should we require the / at the start?

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

No branches or pull requests

1 participant