I have the following dummy local website (configured through two different virtual hosts):
[vhost 1]
https://www.test-laravel.com
DocumentRoot "${INSTALL_DIR}/www/[WEBSITE-DIR]"
[vhost 2]
https://www.test-laravel-direct.com
DocumentRoot "${INSTALL_DIR}/www/[WEBSITE-DIR]/laravel/public"
You can check it out here through GitHub
:
https://github.com/napolev/test-laravel.com
Inside its directory I dropped 4 files:
index.php
page_01.php
page_02.php
page_03.php
with the same content (just to indicate the current file):
<?
echo 'You are on: '.$_SERVER['PHP_SELF'];
?>
Also, inside its directory I installed Laravel
with:
$ laravel new api
On file: laravel\routes\api.php
I configured the following route:
Route::post('/echo-post', function (Request $request) {
return request()->all();
});
If I use [vhost 2]
with Postman
, using the following POST
URL request:
(this case the domain is pointing to the subdirectory: /laravel/public
instead the root directory)
https://www.test-laravel-direct.com/api/echo-post?param1=value1¶m2=value2¶m3=value3
I get the expected response:
{
"param1": "value1",
"param2": "value2",
"param3": "value3"
}
Then, I want to use [vhost 1]
with Postman
, using the following POST
URL request:
(this case the domain is pointing to the root directory instead the subdirectory: /laravel/public
)
https://www.test-laravel.com/api/echo-post?param1=value1¶m2=value2¶m3=value3
For that I configured the root .htaccess
file like:
RewriteEngine On
RewriteBase /laravel/
RewriteRule ^api/(.*)$ /api/$1 [L]
But when running the request with Postman
I get the following output:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>500 Internal Server Error</title>
</head>
<body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
admin@example.com to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body>
</html>
On the Apache
error log I get the following:
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
Do you have any idea on how can I use [vhost 1]
with the following POST
URL request?
https://www.test-laravel.com/api/echo-post?param1=value1¶m2=value2¶m3=value3
Thanks!
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2CKYjRi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire