You are here

other_cms_integration_recv.html.twig in Fastly 8.3

# Make sure X-ExternalCMS is not set before proceeding
if ( req.restarts == 0 ) {
remove req.http.X-ExternalCMS;
}

# Extract first part of the path from a URL
if ( req.url.path ~ "^/?([^:/\s]+).*$" ) {
# check if first part of the url is in the wordpress urls table
if ( table.lookup({{ urls_dict }}, re.group.1, "NOTFOUND") != "NOTFOUND" ) {
set req.http.X-ExternalCMS = "1";
# There is an issue with load-scripts.php in Wordpress where the ordering of query arguments matter
# in compressing the JS. By default Magento sorts query arguments. Here we undo the sorting for wp-admin URLs
if ( req.url.path ~ "/wp-admin" ) {
set req.url = req.http.Magento-Original-URL;
}
}
}

File

fastly_edge_modules/templates/other_cms_integration_recv.html.twig
View source
  1. # Make sure X-ExternalCMS is not set before proceeding
  2. if ( req.restarts == 0 ) {
  3. remove req.http.X-ExternalCMS;
  4. }
  5. # Extract first part of the path from a URL
  6. if ( req.url.path ~ "^/?([^:/\s]+).*$" ) {
  7. # check if first part of the url is in the wordpress urls table
  8. if ( table.lookup({{ urls_dict }}, re.group.1, "NOTFOUND") != "NOTFOUND" ) {
  9. set req.http.X-ExternalCMS = "1";
  10. # There is an issue with load-scripts.php in Wordpress where the ordering of query arguments matter
  11. # in compressing the JS. By default Magento sorts query arguments. Here we undo the sorting for wp-admin URLs
  12. if ( req.url.path ~ "/wp-admin" ) {
  13. set req.url = req.http.Magento-Original-URL;
  14. }
  15. }
  16. }