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

How to account for context path in rewrites #136

Open
bdw429s opened this issue May 29, 2018 · 2 comments
Open

How to account for context path in rewrites #136

bdw429s opened this issue May 29, 2018 · 2 comments

Comments

@bdw429s
Copy link
Member

bdw429s commented May 29, 2018

I was testing starting up a server with the default CommandBox URL rewrites and a custom context path and found it doesn't work which isn't super surprising, but I'm not sure how to fix it.

If I run these commands:

echo "test" > index.cfm
touch includes/test.txt
touch Application.cfm
server set runwar.args="--context-path=/myContext"
start

Then, these URLs work fine:

However, if I enable rewrites:

server set web.rewrites.enable=true
restart --debug

Then this URL still works:

But these URLs don't work:

The error for both of those URLs is a Lucee 404:

Page /myContext/index.cfm [C:\sandbox\contexttest\myContext\index.cfm] not found

It's looking for a physical folder called myContext which doesn't exist. I see this in the debug output which implies that it's getting rewritten:

[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to /index.cfm/index.cfm
and
[DEBUG] urlrewrite.RuleExecutionOutput: needs to be forwarded to /index.cfm/includes/test.txt

So this sort of makes sense that the Rewrites aren't going to find these paths as real physical paths since the context path is in there, but I'm not clear on whether I need to adjust the rewrite rules or whether this is a bug in Runwar, or Tuckey that's not accounting for a servlet context path.

@denuno
Copy link
Member

denuno commented Aug 12, 2018

Hmm, maybe check this out: https://stackoverflow.com/questions/23665573/tuckey-urlrewrite-matching-and-context

Specifically the use-context and %{context-path} bits. The docs seem to say the context will be added automatically, but also maybe that they won't, so... ¯_(ツ)_/¯

@bdw429s
Copy link
Member Author

bdw429s commented Aug 14, 2018

I'll have to give that a test. If it works, perhaps Runwar can set that automatically for sites with a context. This is fairly edge case. Only 1 person I know of who's tried to use a context.

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

2 participants