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

ESI #37

Open
patrikden opened this issue Jul 27, 2017 · 4 comments
Open

ESI #37

patrikden opened this issue Jul 27, 2017 · 4 comments

Comments

@patrikden
Copy link

Version 0.3.0 installed on laravel 5.4.

I try get ESI functionality. I have index page with included:

<esi:include src="{{ route('get-esi') }}"/>

And route to partial:

Route::get('/get-esi', ['as' => 'get-esi', 'uses' => 'IndexController@getesi']);

route('get-esi') conatain only

<h1>Hi! TEST</h1> 

and nothing else. When I'm open it in new window - thats work fine, only

Hi! TEST

on the page.

But when i Try include it like ESI
I try get ESI functionality. I have index page with included:

<esi:include src="{{ route('get-esi') }}"/>

it load index page instead of route('get-esi').

What do I wrong? Please help

@vadson777
Copy link

I have the same issue.
When I include esi tag, middleware parses it, but the answer for esi is the index page.
If index page has esi tag initially, than I get infinite loop of rendering the same page again and again.
I tried to debug, and I found out that Symfony's HttpCache creates a subrequest with the right url (from esi tag), but the answer for this subrequest is index page. But if I try to open this esi-url in new tab I get the right answer.

@dresb
Copy link

dresb commented Jan 30, 2018

I can confirm this issue. A simple test, like

Route::get('esi-get', function () {
    return 'esi content';  
});
Route::group(['middleware' => ['httpcache', 'ttl:300']], function () {  
    Route::get('esi-test', function () {
        return '<div><esi:include src="http://localhost.laravel/esi-get" /></div>';
    });
});

Generates a cached page in storage/httpcache:

<div><?php echo $this->surrogate->handle($this, 'http://localhost.laravel/esi-get', '', false) ?></div>

Which Outputs:

<div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>...

In perpetuity until it runs out of memory when visited.

@carlosvini
Copy link

Same error here, the sub request is dispatched through the middlewares but the route remains the same of the main request.

@josearagon
Copy link

josearagon commented Oct 4, 2019

Hello @barryvdh,

I have same error. ESI include has been create an infinite loop that throw an allowed memory time error or max execution time exceeded.

Can you check it or help me please?

Thanks a lot!

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

5 participants