Skip to content

Commit

Permalink
Keep params from original url
Browse files Browse the repository at this point in the history
  • Loading branch information
hmphu committed Nov 17, 2016
1 parent b1155b3 commit 9819529
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ public function injectEsi($eventObject) {
);
}

/**
* Keep params from original url
*/
$urlOptions['_query'] = Mage::app()->getRequest()->getParams();

$esiUrl = Mage::getUrl('turpentine/esi/getBlock', $urlOptions);
if ($esiOptions[$methodParam] == 'esi') {
// setting [web/unsecure/base_url] can be https://... but ESI can never be HTTPS
Expand Down

4 comments on commit 9819529

@jeroenvermeulen
Copy link
Contributor

@jeroenvermeulen jeroenvermeulen commented on 9819529 Aug 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you do this?
I have a situation at a customer where query stings like ?id=5 and ?id=64&order=popularity are added to the ESI URLs by your code.
This makes the ESI URLs more unique than needed, which causes blocks that have <scope>global</scope> act like they have <scope>page</scope>, which causes lots of extra ESI requests.

I have a better solution for you:
When you need the query parameters from the original URL, you can change the block to <scope>page</scope> which will cause the refering URL to encoded in the ESI URL including the query string (params). In this script I show how to decode it. I can't find any helper function in Turpentine to retrieve it more easily.

@jeroenvermeulen
Copy link
Contributor

@jeroenvermeulen jeroenvermeulen commented on 9819529 Aug 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miguelbalparda: Would you like a PR to undo this change? I think it is the wrong solution.
I could add a helper function to retrieve the Referer URL in case op <scope>page</scope>.
BTW: In the Turpentine source code the word Referer is spelled Referrer most of the time.

@OleksiiStepanov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree @jeroenvermeulen it's make all esi blocks with scope global doesn't work properly

@jeroenvermeulen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had another big shop where this bug was a huge performance drain.
Fix in #1530
@miguelbalparda Please merge.

Please sign in to comment.