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

Rewrite does double redirect if you dont have leading / on from #119

Open
gpickin opened this issue Apr 4, 2018 · 4 comments
Open

Rewrite does double redirect if you dont have leading / on from #119

gpickin opened this issue Apr 4, 2018 · 4 comments

Comments

@gpickin
Copy link

gpickin commented Apr 4, 2018

RewriteCond %{QUERY_STRING} .*hotelID\=.*$
RewriteRule    (.*) /410.html [L]```

Instead of redirecting to /410.html it redirects to /410.html/410.html

[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: processing request for /resorts/resort.cfm
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: Rule 0 run called with /resorts/resort.cfm
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: matched "from"
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating "/resorts/resort.cfm" against ^/resorts/resort.cfm.*
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating "hotelID=RVMVLAH&1=2" against .hotelID=.$
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: conditions match
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.SetAttribute DEBUG: set Set status null 410 called
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.SetAttribute DEBUG: setting status
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to be forwarded to /410.html/410.html
[INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: rule is last
[DEBUG] runwar.request: * requested:410.html/410.html

@gpickin
Copy link
Author

gpickin commented Apr 4, 2018

Note, this doesn't happen on an ordinary rewrite rule.

@gpickin gpickin changed the title RewriteCond has double redirect Rewrite does double redirect if you dont have leading / on from Apr 4, 2018
@gpickin
Copy link
Author

gpickin commented Apr 4, 2018

Figured it out...

/.* for the FROM
RewriteRule /.* 410.html works

RewriteRule .* 410.html wont
You need the / for the from or it wont work.

@gpickin
Copy link
Author

gpickin commented Apr 4, 2018

To compare vs apache 2.0 I ran a few tests

httpd rewrites are weird too but different weird than Runwar

With a rewrite, the from rule something like /index.htm doesn't match... but index.htm does match... the URI coming in with httpd 2.0 does not have the /
so that is different to runwar for sure
and IIS does have the / in it according to a customer file.

for the TO it never seems to be relative
For this rule RewriteRule ^.*$ oops.html
http://enterprise.netxn.com/~gavinpickin/test/fun/index.html http://enterprise.netxn.com/~gavinpickin/index.html both return
The requested URL /home/gavinpickin/public_html/oops.html was not found on this server.

If you make it absolute RewriteRule ^.*$ /oops.html then it looks for the root of the drive The requested URL /oops.html was not found on this server.

runwar seems to make it relative to the context of the site or the folder of the attempted page ( relative bug )

The server I tested on is just plain jane with no special options, ie default settings.

Hope this helps.
Not sure if we should match some set of settings, or some documented settings.
Interesting.

@gpickin
Copy link
Author

gpickin commented May 4, 2018

This is still broken.

[DEBUG] urlrewrite.UrlRewriter: processing request for /
[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to /410.html/410.html
[DEBUG] urlrewrite.UrlRewriter: rule is last
[WARN ] responded: Status Code 404 (/410.html/410.html?hotelid=123)```

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