Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David 29 posts 200 karma points
    Oct 18, 2019 @ 10:59
    David
    0

    Umbraco Preview Mode - Lazyload undefined

    I have recently upgraded from 8.1.5 to 8.2 through Nuget, and now when previewing nodes, I get:

    Failed to load resource: the server responded with a status of 404 (Not Found)
    Application?umb__rnd=637b8440e9a0c023130009e82bce987d:1 Uncaught ReferenceError: LazyLoad is not defined
        at Application?umb__rnd=637b8440e9a0c023130009e82bce987d:1
    

    I have followed all steps from: https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/53815-Uncaught-referenceError-LazyLoad-is-not-defined but had no luck.

    Can anyone suggest anything else I can try to resolve this?

  • David 29 posts 200 karma points
    Oct 18, 2019 @ 15:57
    David
    0

    An update on my query, I have narrowed it down to if I remove/comment out the following in my web.config. The preview then works.

    <rewrite>
      <rewriteMaps configSource="IISRewriteRules.config"/>
      <rules>
        <rule name="Remove trailing slash" stopProcessing="true">
          <match url="(.*)/$"/>
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="{R:1}"/>
        </rule>
        <rule name="Redirects">
          <match url="(.*)"/>
          <conditions>
            <add input="{Redirects:{REQUEST_URI}}" pattern="(.+)"/>
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="{C:1}"/>
        </rule>
      </rules>
    </rewrite>
    

    I need these redirects as there are 150+.

    If I run the project using IIS Express, or Local IIS, with the permissions on the project folder/IUSR and/or IIS_USERS set to "full access", this still makes no difference.

    Any help would be much apprenticed.

  • SteveV 54 posts 240 karma points
    Oct 19, 2019 @ 13:27
    SteveV
    0

    I would add a condition when the URL starts with /umbraco to not run the redirect.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Oct 19, 2019 @ 16:13
    Markus Johansson
    1

    Hi!

    We use something like this to about this issue for backoffice-requests:

      <rule name="Remove trailing slash" stopProcessing="true">
          <match url="(.*)/$" />
          <conditions>
            <add input="{REQUEST_URI}" pattern="^/(umbraco|umbraco_client)" negate="true" ignoreCase="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
         <action type="Redirect" redirectType="Permanent" url="{R:1}"/>
        </rule>
    
  • David 29 posts 200 karma points
    Oct 21, 2019 @ 08:10
    David
    1

    Thanks so much Markus. This has resolved the problem.

    My final code is:

    <rewrite>
      <rewriteMaps configSource="IISRewriteRules.config"/>
      <rules>
        <rule name="Remove trailing slash" stopProcessing="true">
          <match url="(.*)/$" />
          <conditions>
            <add input="{REQUEST_URI}" pattern="^/(umbraco|umbraco_client)" negate="true" ignoreCase="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="{R:1}"/>
        </rule>
        <rule name="Redirects">
          <match url="(.*)"/>
          <conditions>
            <add input="{Redirects:{REQUEST_URI}}" pattern="^/(umbraco|umbraco_client)" negate="true" ignoreCase="true" />
            <add input="{Redirects:{REQUEST_URI}}" pattern="(.+)"/>
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="{C:1}"/>
        </rule>
      </rules>
    </rewrite>
    
  • Aileen Jen 3 posts 75 karma points
    Oct 29, 2020 @ 20:43
    Aileen Jen
    2

    Thank you so much for the solution you posted, Markus. This has solved our problem.

    This is what I ended up with:

    <rules>
      <rule name="Remove trailing slash" stopProcessing="true">
        <match url="(.*)/$" />
        <conditions>
          <add input="{REQUEST_URI}" pattern="^/umbraco" negate="true" ignoreCase="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Redirect" redirectType="Permanent" url="{R:1}" />
      </rule>
    </rules>
    
  • Liam Laverty 8 posts 100 karma points c-trib
    Mar 02, 2021 @ 14:26
    Liam Laverty
    0

    A note for testing this, when you make changes to the web.config file you may need to sign out of Umbraco and then back in for the preview feature to become available.

  • Chris 8 posts 110 karma points c-trib
    Mar 04, 2021 @ 17:03
    Chris
    0

    Another note for testing this:

    It appears that chrome will hard cache permanent redirects, so applying a fix in your rewrite rules might appear to do nothing at all. You might need to clear the cache by going to chrome://settings/clearBrowserData, and clearing 'Cached images and files'.

    I'd hope this saves someone banging their head against a wall like me trying to figure out why it wasn't working.

    For reference: https://stackoverflow.com/a/35093587

Please Sign in or register to post replies

Write your reply to:

Draft