<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kirin Vale</title>
    <description>The latest articles on DEV Community by Kirin Vale (@kirinvale).</description>
    <link>https://dev.to/kirinvale</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4267705%2F8fa26431-7e23-4be7-b6cd-36e426541896.png</url>
      <title>DEV Community: Kirin Vale</title>
      <link>https://dev.to/kirinvale</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kirinvale"/>
    <language>en</language>
    <item>
      <title>A "dynamic QR code" is just a 302 redirect you rent</title>
      <dc:creator>Kirin Vale</dc:creator>
      <pubDate>Fri, 27 Nov 2026 14:15:31 +0000</pubDate>
      <link>https://dev.to/kirinvale/a-dynamic-qr-code-is-just-a-302-redirect-you-rent-5eo4</link>
      <guid>https://dev.to/kirinvale/a-dynamic-qr-code-is-just-a-302-redirect-you-rent-5eo4</guid>
      <description>&lt;p&gt;Every few weeks someone asks why the QR code on their flyers, menus or business cards suddenly opens a "this code has expired" page. The code didn't break. The image is the same image it always was. What changed is a redirect on someone else's server.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's actually inside a QR code
&lt;/h2&gt;

&lt;p&gt;A QR code is a picture of a short piece of text. When that text is a URL, your phone reads it and offers to open it. That's all. There's no clock in there, no license, nothing that can run out.&lt;/p&gt;

&lt;p&gt;So there are really two kinds of codes people get from generator sites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static&lt;/strong&gt;: the pattern spells out your real URL, say &lt;code&gt;https://mybakery.com/menu&lt;/code&gt;. Scan it and you go straight there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Dynamic"&lt;/strong&gt;: the pattern spells out the generator's short link, something like &lt;code&gt;https://qr-thing.example/x8K2p&lt;/code&gt;. Their server answers with a redirect to your real URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second one is what lets you "edit" a printed code later. You can't change the pattern, but they can change where &lt;code&gt;/x8K2p&lt;/code&gt; redirects. Under the hood it's roughly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x8K2p&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;
&lt;span class="nc"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;qr&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;thing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;

&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt; &lt;span class="nc"&gt;Found&lt;/span&gt;
&lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//mybakery.com/menu&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Useful! But it also means the code only works as long as that company keeps serving the redirect for you. A lot of the free tiers are trials, and when the trial ends the redirect starts pointing at a "renew your plan" page instead. That's the "expired QR code" people run into.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to tell which kind you have
&lt;/h2&gt;

&lt;p&gt;Scan it with your phone camera and look at the link preview before you tap.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If it shows your own domain, it's static. It will keep working as long as that page exists.&lt;/li&gt;
&lt;li&gt;If it shows the generator's domain with a short code, it's a redirect you're renting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also decode it on your machine if you're curious, e.g. with &lt;code&gt;zbarimg code.png&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Editable without renting it
&lt;/h2&gt;

&lt;p&gt;If you want a code you can re-point later, you don't need a dynamic QR service. Put the redirect on a domain you control:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick a path you'll never rename, like &lt;code&gt;https://mybakery.com/go/menu&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make a plain static QR code for exactly that URL and print it.&lt;/li&gt;
&lt;li&gt;Whenever you want it to point somewhere else, change the redirect. On most hosts that's one line, for example a Cloudflare redirect rule, a Netlify &lt;code&gt;_redirects&lt;/code&gt; entry:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/go/menu  https://docs.google.com/document/d/abc123  302
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or an nginx &lt;code&gt;return 302 ...;&lt;/code&gt;. Wix, Squarespace and Shopify all have a redirects page in their settings for non-developers.&lt;/p&gt;

&lt;p&gt;The printed code never changes because the URL inside it never changes. The only thing you have to keep paying for is your own domain, which you were paying for anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few printing things that bite people
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keep it dark on light. Inverted codes (light on dark) don't scan on every phone.&lt;/li&gt;
&lt;li&gt;Leave a white border around it. The spec calls it the quiet zone, and scanners need it.&lt;/li&gt;
&lt;li&gt;Don't go tiny. Around 2 cm wide is a sane minimum for something people hold in their hand, bigger for posters across a room.&lt;/li&gt;
&lt;li&gt;Shorter URLs give you a simpler pattern that scans faster and survives a bit of blur.&lt;/li&gt;
&lt;li&gt;Scan a real printout before you print 500 of them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to make a static one
&lt;/h2&gt;

&lt;p&gt;Pretty much anything that encodes your exact URL works. Chrome and Edge have a "Create QR code" option in the share menu. &lt;code&gt;qrencode&lt;/code&gt; on the command line is great. Disclosure: I also make a small one, &lt;a href="https://qrsthatlast.com/?ref=a6eqjahai" rel="noopener noreferrer"&gt;QRs That Last&lt;/a&gt;, which only does static codes (links, Wi-Fi, text, email, phone, SMS) and renders the Wi-Fi ones in your browser so the password never leaves your machine. But the point of this post is that you don't need any particular tool, you just need the code to contain your URL and not someone else's.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
