Laravel app routes incorrectly for mod
I am working with a legacy PHP application with a Laravel application as an API handler. Both the legacy app and the Laravel app are within the same domain and are on the same server. Laravel is symlinked from a sub-folder within the legacy application. The webserver is Apache.
I have Laravel set up with endpoints for returning PDFs. The PDFs are generated by the Legacy app, and are named, and placed in directories based on business rules (customer ID, location, etc). ie /22/435123/435123-22.pdf where 22 is the location and 435123 is the customer id.
The endpoint works perfectly if I enter it as a URL. To access it from the legacy app, I use an .htaccess rewrite rule to rewrite the legacy route/URL. Rewrite rule test sites show that the URL is rewritten correctly. The Laravel route (using the above example) is: /api/22/435123?filename=435123-22.pdf
When I hit the route from the legacy app, Laravel routes to the index.php in Laravel with filename query appended. index.php?filename=435123-22.pdf
Here is the rewrite ($2 is irrelevant for the api) RewriteRule ^files/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ /laravel/api/$1/$3?filename=$4
Any ideas? Any other info I can provide?
EDIT
On the Laravel side, I added logging middleware to log the requests hitting the API. Laravel logs the request URI as [Laravel Root]/index.php?[query string sent from legacy app]
The solution was to rewrite to the full path.
ie https://%{HTTP_HOST}/laravel/api/$1/$3?filename=$4
上一篇: Nexmo仅限于全球发送的消息
下一篇: Laravel应用程序不正确地路由mod