{"id":18670,"date":"2021-06-15T13:18:42","date_gmt":"2021-06-15T10:18:42","guid":{"rendered":"https:\/\/plumrocket.com\/docs\/?p=18670"},"modified":"2021-09-21T09:14:02","modified_gmt":"2021-09-21T13:14:02","slug":"loading-product-options-gets-stuck-in-the-amp-iframe","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck","title":{"rendered":"Loading Product Options Gets Stuck in the AMP Iframe"},"content":{"rendered":"\n<h2>Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d<\/h2>\n\n\n\n<p>The message&nbsp;<strong>\u201cLoading Product Options\u201d<\/strong>&nbsp;is displayed on&nbsp;<a href=\"https:\/\/plumrocket.com\/magento-amp\">Magento 2 AMP<\/a>&nbsp;pages, the loader gets stuck spinning and never loads.<\/p>\n\n\n\n<p>Please see the screenshot below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1206\" height=\"714\" src=\"\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png\" alt=\"Amp-loading-options.png\" class=\"wp-image-18960\" srcset=\"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png 1206w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1-300x178.png 300w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1-1024x606.png 1024w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1-768x455.png 768w\" sizes=\"(max-width: 1206px) 100vw, 1206px\" \/><\/figure>\n\n\n\n<p>Another way to debug this issue is by opening the Iframe source in a new window. The browser will display the following error message:&nbsp;<span class=\"has-blue-color\"><em>\u201cThis page isn&#8217;t working. Domain.com redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS.\u201d<\/em><\/span><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1206\" height=\"714\" src=\"\/docs\/wp-content\/uploads\/2021\/06\/Page-not-working-1.png\" alt=\"Page-not-working.png\" class=\"wp-image-18959\" srcset=\"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Page-not-working-1.png 1206w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Page-not-working-1-300x178.png 300w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Page-not-working-1-1024x606.png 1024w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Page-not-working-1-768x455.png 768w\" sizes=\"(max-width: 1206px) 100vw, 1206px\" \/><\/figure>\n\n\n\n<h2>Issue Description<\/h2>\n\n\n\n<p>The issue happens when website redirects are configured in your web server affecting the ampiframe.php file. In most cases, the 301\/302 rewrite rule redirecting non-www to the www version of the website will cause the AMP Iframe to fail to load.<\/p>\n\n\n\n<h2>Solution 1 (Recommended)<\/h2>\n\n\n\n<h3>Step 1<\/h3>\n\n\n\n<p>Disable the 301\/302 redirects in your webserver affecting the&nbsp;<strong>ampiframe.php<\/strong>&nbsp;file<\/p>\n\n\n\n<p><strong>Disable Apache Web Server Redirects<\/strong><\/p>\n\n\n\n<p>If you are using an Apache web server, find and edit your <strong>httpd.conf<\/strong> and <strong>.htaccess<\/strong> files:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">vi \/path\/to\/magento2\/.htaccess\nvi \/path\/to\/magento2\/pub\/.htaccess\nvi \/etc\/httpd\/conf\/httpd.conf<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Remove or comment <a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/rewrite\/remapping.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">redirects similar to these:<\/a><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">httpd.conf or .htaccess<\/div><pre><code class=\"language-\">RewriteCond %{HTTP_HOST} !^www\\. [NC]\nRewriteRule ^(.*)$ http:\/\/www.%{HTTP_HOST}\/$1 [R=301,L]\n\nRewriteCond %{HTTP_HOST} ^www\\.(.*)$ [NC]\nRewriteRule ^(.*)$ http:\/\/%1\/$1 [R=301,L]<\/code><\/pre><\/div>\n\n\n\n<p><strong>Disable Nginx Web Server Redirects<\/strong><\/p>\n\n\n\n<p>If you are using a Nginx web server, find and edit your&nbsp;<strong>virtual host<\/strong>&nbsp;file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">vi \/etc\/nginx\/sites-available\/&lt;domain.com>.conf<\/code><\/pre><\/div>\n\n\n\n<p>Remove or comment similar\u00a0<a href=\"http:\/\/nginx.org\/en\/docs\/http\/converting_rewrite_rules.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">rewrite rules:<\/a><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\"> server {\n listen 80;\n server_name domain.com;\n return 301 http:\/\/www.domain.com$request_uri;\n }<\/code><\/pre><\/div>\n\n\n\n<h3>Step 2<\/h3>\n\n\n\n<p>Then\u00a0<a href=\"https:\/\/docs.magento.com\/user-guide\/configuration\/general\/web.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">enable the Auto-redirect to Base URL<\/a>\u00a0in your Magento backend:<\/p>\n\n\n\n<p>Go to&nbsp;<strong>Configuration &gt; Web &gt; Auto-redirect to Base URL<\/strong>&nbsp;and make sure that you have a 302 (or 301) redirect enabled in Magento settings. This setting prevents duplicate content issues in Google.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1206\" height=\"600\" src=\"\/docs\/wp-content\/uploads\/2021\/06\/Auto-redirect-1.png\" alt=\"Auto-redirect.png\" class=\"wp-image-18957\" srcset=\"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Auto-redirect-1.png 1206w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Auto-redirect-1-300x149.png 300w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Auto-redirect-1-1024x509.png 1024w, https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Auto-redirect-1-768x382.png 768w\" sizes=\"(max-width: 1206px) 100vw, 1206px\" \/><\/figure>\n\n\n\n<h3>Step 3<\/h3>\n\n\n\n<p>Now go back to your browser and refresh the AMP product page. The AMP Iframe should be displayed correctly.<\/p>\n\n\n\n<h2>Solution 2<\/h2>\n\n\n\n<p>Another way to solve webserver redirect issues for AMP Iframe is to exclude&nbsp;<strong>ampiframe.php<\/strong>&nbsp;from 301\/302 redirects.<br><br><strong>Exclude ampiframe.php From Apache Web Server Redirects<\/strong><\/p>\n\n\n\n<p>If you are using an Apache web server, find and edit your&nbsp;<strong>httpd.conf<\/strong>&nbsp;and&nbsp;<strong>.htaccess<\/strong>&nbsp;files:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">vi \/path\/to\/magento2\/.htaccess\nvi \/path\/to\/magento2\/pub\/.htaccess\nvi \/etc\/httpd\/conf\/httpd.conf<\/code><\/pre><\/div>\n\n\n\n<p><strong>Add ONE of the following changes to your Apache redirects<\/strong>:<br><br><strong>Option 1:<\/strong><\/p>\n\n\n\n<p>Add line &#8220;<span class=\"has-blue-color\"><em>RewriteCond&nbsp;%{REQUEST_URI}&nbsp;!^\/ampiframe.php<\/em><\/span>&#8221; as shown below:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">RewriteEngine on\nRewriteCond %{REQUEST_URI} !^\/ampiframe.php\nRewriteRule (.*) https:\/\/www.domain.com\/$1 [R=301,L]<\/code><\/pre><\/div>\n\n\n\n<p><br><strong>Option 2:<\/strong><\/p>\n\n\n\n<p>Add the following line at the top of your rewrite rules before any other calls&nbsp;:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">RewriteRule ^(ampiframe.php) - [L]<\/code><\/pre><\/div>\n\n\n\n<p><br><strong>Option 3:<\/strong><\/p>\n\n\n\n<p>Replace your existing redirect rule with the following:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">RedirectMatch 301 ^\/((?!ampiframe.php).*)$ https:\/\/www.domain.com\/$1<\/code><\/pre><\/div>\n\n\n\n<ul><li>domain.com &#8211; is your Magento store domain name<\/li><\/ul>\n\n\n\n<p><strong>Exclude ampiframe.php From Nginx Web Server Redirects<\/strong><\/p>\n\n\n\n<p>If you are using a Nginx web server, find and edit your&nbsp;<strong>virtual host<\/strong>&nbsp;file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">vi \/etc\/nginx\/sites-available\/&lt;domain.com>.conf<\/code><\/pre><\/div>\n\n\n\n<p>Add location block &#8220;<span class=\"has-blue-color\"><em>location \/ampiframe.php<\/em><\/span>&#8221; as shown below:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">server {\n \n listen 80;\n server_name www.domain.com domain.com;\n \n location \/ {\n # redirect to https version of the domain\n return 301 https:\/\/www.domain.com$request_uri;\n }\n \n location \/ampiframe.php {\n # Do nothing. Nginx will exclude the amp-iframe file from redirect\n root \/path\/to\/webroot;\n }\n \n}<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is displayed on&nbsp;Magento 2 AMP&nbsp;pages, the loader gets stuck spinning and never loads. Please see the screenshot below: Another way to debug this issue is by opening the Iframe source in a new window. The browser will display &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Loading Product Options Gets Stuck in the AMP Iframe&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[106],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Loading Product Options Gets Stuck in the AMP Iframe - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Loading Product Options Gets Stuck in the AMP Iframe\" \/>\n<meta property=\"og:description\" content=\"Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-15T10:18:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-21T13:14:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Loading Product Options Gets Stuck in the AMP Iframe - Plumrocket Documentation","description":"Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck","og_locale":"en_US","og_type":"article","og_title":"Loading Product Options Gets Stuck in the AMP Iframe","og_description":"Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is","og_url":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck","og_site_name":"Plumrocket Documentation","article_published_time":"2021-06-15T10:18:42+00:00","article_modified_time":"2021-09-21T13:14:02+00:00","og_image":[{"url":"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck#primaryimage","inLanguage":"en-US","url":"\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png","contentUrl":"\/docs\/wp-content\/uploads\/2021\/06\/Amp-loading-options-1.png"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck#webpage","url":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck","name":"Loading Product Options Gets Stuck in the AMP Iframe - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck#primaryimage"},"datePublished":"2021-06-15T10:18:42+00:00","dateModified":"2021-09-21T13:14:02+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20"},"description":"Loading Product Options Gets Stuck. Browser Displays Error: \u201cDomain.com redirected you too many times.\u201d The message&nbsp;\u201cLoading Product Options\u201d&nbsp;is","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting\/amp-iframe-options-stuck#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/magento-extensions"},{"@type":"ListItem","position":2,"name":"Magento 2 AMP","item":"https:\/\/plumrocket.com\/magento-amp"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-amp"},{"@type":"ListItem","position":4,"name":"v3","item":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3"},{"@type":"ListItem","position":5,"name":"Troubleshooting","item":"https:\/\/plumrocket.com\/docs\/magento-amp\/v3\/troubleshooting"},{"@type":"ListItem","position":6,"name":"Loading Product Options Gets Stuck in the AMP Iframe"}]},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","caption":"Plumrocket"},"sameAs":["https:\/\/plumrocket.com\/docs"]}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/18670"}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=18670"}],"version-history":[{"count":2,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/18670\/revisions"}],"predecessor-version":[{"id":24193,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/18670\/revisions\/24193"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=18670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=18670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=18670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}