-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Routing is broken when Config[TMVCConfigKey.PathPrefix] is set #555
Comments
Why do you need that ugly path for ISAPI? My URLs look like
I posted a guide here back in 2019 which explains how to host isapi files on IIS |
|
No probs, I understand that sometimes legacy deployment can rule out cleaner solutions 😀 |
Something like the following: {$IF Not Defined(CONSOLE)}
Config[TMVCConfigKey.PathPrefix] := '/v1/pjapi.dll';
{$ELSE}
Config[TMVCConfigKey.PathPrefix] := ''; // just to be clear
{$ENDIF} |
That is exactly how i do it. The problem is that with ISAPI and the PathPrefix '/v1/pjapi.dll' it does not work. I would say it wont work with any PathPrefix you set other than '', when you do not make the changes i mentioned above. That is my point. |
If you set a Prefix like
Config[TMVCConfigKey.PathPrefix] := '/v1/pjapi.dll';
then the function TMVCRouter.ExecuteRouting fails to find the correct route and ends always in a "404 Not Found" error.
i had to change following code lines in MVCFramework.Router to get it work:
replaced the line
if not LRequestPathInfo.StartsWith(APathPrefix + LControllerMappedPath, True) then
with
if not LRequestPathInfo.StartsWith(LControllerMappedPath, True) then
and
if IsCompatiblePath(APathPrefix + LControllerMappedPath + LMethodPath, LRequestPathInfo, ARequestParams) then
with
if IsCompatiblePath(LControllerMappedPath + LMethodPath, LRequestPathInfo, ARequestParams) then"
I am not sure if i did it the right way, but it works now in isapi with prefix and local as exe without prefix. Maybe this is worth to get a deeper look on it?
The text was updated successfully, but these errors were encountered: