0

I have an app in IIS whose url is "http://localhost/MAIN", please note the uppercase virtual directory.

When I try to access this url with a lower case app/virtual directory name, like "http://localhost/main" then the app turns the url into "http://localhost/MAIN/Account/Login?ReturnUrl=%2fmain" note the "%2fmain". Upon performing a login, I get redirected back to the login page/route.

I think IIS should return a 404 for lower case virtual directory name.

Can anyone shed some light on this?

  • IIS is case insensitive regarding virtual directories and file paths. /MAIN and /main are the same. Just like INDEX.HTM and index.htm are the same. In your case I guess MVC is just being "smart" (take that as you will). – Greg W Jun 9 '17 at 13:35
1

have had same problem

Change strpos for stripos in function getUrlencodedPrefix located at vendor\symfony\http-foundation\Request.php.

We have had issues accessing our laravel application on IIS with fast-cgi.

The app url http://server/myApp points to the application public folder and 90% of the time it works, but for some reason after days of being OK it suddenly stops working with a route error [in RouteCollection.php (line 179)]. The only way to get access back through the same url but lowercase "A" http://server/myapp. After days it switches back to uppercase "A".

The issue became worst about 2 days ago when it started switching almost on an hourly bases.

We have traced back the issue to vendor\symfony\http-foundation\Request.php line 2043 [strpos changing it to stripos] fixed the problem.

What seems to be the root cause is the handleing of fast-cgi with the _SERVER['SCRIPT_NAME'] variable. When the application pool recycles the php-cgi.exe process the first request to the process will set this variable to the Case Sensative portion of the virtual folder. From then on matchAgainstRoutes (vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php) will fail as the case will not match.

I am looking for a long term solution, as any update at Symphony Core or Laravel will most probably change this FIX back. I hope in the meantime this post will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.