<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Javascript – Yeri Tiete</title>
    <link>https://yeri.be/tag/javascript/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Wed, 16 Nov 2022 16:07:46 +0100</lastBuildDate>
    <atom:link href="https://yeri.be/tag/javascript/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Using Mastodon with Cloudflare</title>
      <link>https://yeri.be/using-mastodon-with-cloudflare/</link>
      <pubDate>Wed, 16 Nov 2022 16:07:46 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/using-mastodon-with-cloudflare/</guid><enclosure url="https://static.yeri.be/2022/11/mastodon.png" length="0" type="image/png" />
      <description>&lt;p&gt;If you&#39;re using Mastodon with Cloudflare CDN/protection and &lt;a href=&#34;http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;minify&lt;/a&gt; turned on, you&#39;ll notice the site may look broken (after a few visits, when hitting Cloudflare cache).&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;&lt;img src=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png&#34; alt=&#34;&#34; class=&#34;wp-image-70935&#34;/&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-element-caption&#34;&gt;Yeah, that&#39;s not how it&#39;s supposed to look.&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;p&gt;And you&#39;ll notice errors in the webdev tools similar to &lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute, with computed SHA-256 integrity&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js&#39; with computed SHA-256 integrity &#39;YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js&#39; with computed SHA-256 integrity &#39;1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js&#39; with computed SHA-256 integrity &#39;onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ=&#39;. The resource has been blocked.&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Basically, the sha256 hash doesn&#39;t match the js or css static files. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/mastodon.png" alt="Using Mastodon with Cloudflare"></p><p>If you're using Mastodon with Cloudflare CDN/protection and <a href="http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify" target="_blank" rel="noreferrer noopener">minify</a> turned on, you'll notice the site may look broken (after a few visits, when hitting Cloudflare cache).</p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png" alt="" class="wp-image-70935"/></a><figcaption class="wp-element-caption">Yeah, that's not how it's supposed to look.</figcaption></figure>
<p>And you'll notice errors in the webdev tools similar to <code>Failed to find a valid digest in the 'integrity' attribute, with computed SHA-256 integrity</code>:</p>
<pre class="wp-block-code"><code>Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js' with computed SHA-256 integrity 'YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js' with computed SHA-256 integrity '1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js' with computed SHA-256 integrity 'onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ='. The resource has been blocked.</code></pre>
<p>Basically, the sha256 hash doesn't match the js or css static files. </p>
<p>This happens because Cloudflare minifies those files and thus the hash has been changed.</p>
<p>To get it to work correctly, you'll need to create a Page Rule via <code>Rules > Page Rules > Create Page Rule</code> with the following info: </p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-1024x500.png" alt="" class="wp-image-70937"/></a><figcaption class="wp-element-caption">The page rule created; in this screenshot, the rule is still turned off.</figcaption></figure>
<ul>
<li>URL: YourMastodonURL.com/packs/*</li>
<li>Settings: Auto Minify: off (do not select anything)</li>
<li>Rocket Loader: slider off</li>
</ul>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule-details.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-details-1011x1024.png" alt="" class="wp-image-70938"/></a><figcaption class="wp-element-caption">Details on the page rule. Save and deploy.</figcaption></figure>
<p>Don't forget to purge your cache via the dashboard (for the Mastodon domain) via <code>Caching > Custom Purge > Hostname > YourMastodonURL.com</code>.</p>
]]></content:encoded>
      <category>errors</category><category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>javascript</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Quick reset!</title>
      <link>https://yeri.be/quick-reset/</link>
      <pubDate>Sat, 04 Oct 2008 01:33:03 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/quick-reset/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve added some &amp;ldquo;quick reset&amp;rdquo; javascript to the from and to fields. Should be easier to use, if you want to change stations. Hope the link isn&amp;rsquo;t too small for the iPhone-finger. :) &amp;ndash; This is a request for comments !&lt;/p&gt;&#xA;&lt;p style=&#34;text-align: center;&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2008/10/photo1.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img class=&#34;alignnone size-medium wp-image-589&#34; title=&#34;iRail station reset&#34; src=&#34;https://static.yeri.be/2008/10/photo1-200x300.jpg&#34; alt=&#34;&#34; width=&#34;200&#34; height=&#34;300&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p style=&#34;text-align: left;&#34;&gt;There also were a little over 1000 visitors yesterday (Thursday) on the website. Not bad! :)&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I&rsquo;ve added some &ldquo;quick reset&rdquo; javascript to the from and to fields. Should be easier to use, if you want to change stations. Hope the link isn&rsquo;t too small for the iPhone-finger. :) &ndash; This is a request for comments !</p>
<p style="text-align: center;"><a href="https://static.yeri.be/2008/10/photo1.jpg" target="_blank" rel="noopener"><img class="alignnone size-medium wp-image-589" title="iRail station reset" src="https://static.yeri.be/2008/10/photo1-200x300.jpg" alt="" width="200" height="300" /></a></p>
<p style="text-align: left;">There also were a little over 1000 visitors yesterday (Thursday) on the website. Not bad! :)</p>
]]></content:encoded>
      <category>misc</category><category>software</category><category>irail</category><category>www</category>
      <category>iphone</category><category>javascript</category><category>nmbs</category><category>sncb</category>
    </item>
    
  </channel>
</rss>
