<?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: Ashwin</title>
    <description>The latest articles on DEV Community by Ashwin (@ashwin7).</description>
    <link>https://dev.to/ashwin7</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%2F4024249%2Ff774e977-ad03-4a6b-a8bf-5606bbaebca8.jpg</url>
      <title>DEV Community: Ashwin</title>
      <link>https://dev.to/ashwin7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashwin7"/>
    <language>en</language>
    <item>
      <title>How to Set Up a Free, Full HTTPS Domain Redirect with Cloudflare and Namecheap</title>
      <dc:creator>Ashwin</dc:creator>
      <pubDate>Thu, 30 Jul 2026 03:44:48 +0000</pubDate>
      <link>https://dev.to/ashwin7/how-to-set-up-a-free-full-https-domain-redirect-with-cloudflare-and-namecheap-3n6d</link>
      <guid>https://dev.to/ashwin7/how-to-set-up-a-free-full-https-domain-redirect-with-cloudflare-and-namecheap-3n6d</guid>
      <description>&lt;p&gt;If you have ever bought a domain on Namecheap to redirect traffic to your main web app, you might have hit a frustrating wall: Namecheap's free "Domain Redirect" feature works fine for plain &lt;code&gt;http://&lt;/code&gt; requests, but it completely falls flat when someone hits &lt;code&gt;https://&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Browsers try to perform an SSL/TLS handshake before following the HTTP redirect header. Because Namecheap does not issue a free SSL certificate for basic domain forwarding, your users end up seeing a scary "Your connection is not private" error.&lt;/p&gt;

&lt;p&gt;Here is how to set up a full, seamless redirect from an old domain (&lt;code&gt;snapseek.co&lt;/code&gt;) to a new domain (&lt;a href="https://snapseek.app" rel="noopener noreferrer"&gt;snapseek.app&lt;/a&gt;) using Cloudflare's free tier. This approach handles both HTTP and HTTPS, while preserving all incoming URL paths and query parameters.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;Instead of serving traffic through Namecheap's basic forwarding servers, we hand off DNS management to Cloudflare.&lt;/p&gt;

&lt;p&gt;Cloudflare acts as a reverse proxy, provides a free universal SSL/TLS certificate, and handles the redirection right at the edge using its modern &lt;strong&gt;Single Redirect Rules&lt;/strong&gt; engine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Add Your Domain to Cloudflare
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log into your free &lt;a href="https://dash.cloudflare.com/" rel="noopener noreferrer"&gt;Cloudflare account&lt;/a&gt; (or sign up if you do not have one).&lt;/li&gt;
&lt;li&gt;On your dashboard under the &lt;strong&gt;Home&lt;/strong&gt; tab, click &lt;strong&gt;Add a domain&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type in your source domain (e.g., &lt;code&gt;snapseek.co&lt;/code&gt;) and choose &lt;strong&gt;Quick scan for DNS records&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;When prompted to select a plan, scroll down to the bottom and pick the &lt;strong&gt;Free&lt;/strong&gt; plan.&lt;/li&gt;
&lt;li&gt;Cloudflare will scan your existing DNS setup. Scroll down and click &lt;strong&gt;Continue to activation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Cloudflare will display a pair of custom nameservers (for example: &lt;code&gt;ada.ns.cloudflare.com&lt;/code&gt; and &lt;code&gt;sam.ns.cloudflare.com&lt;/code&gt;). Copy these down.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 2: Update Nameservers in Namecheap
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log into your &lt;strong&gt;Namecheap account&lt;/strong&gt; and go to your &lt;strong&gt;Domain List&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Manage&lt;/strong&gt; next to your domain (&lt;code&gt;snapseek.co&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Find the &lt;strong&gt;Nameservers&lt;/strong&gt; dropdown section.&lt;/li&gt;
&lt;li&gt;Switch it from &lt;em&gt;Namecheap BasicDNS&lt;/em&gt; to &lt;strong&gt;Custom DNS&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste the two Cloudflare nameservers into the fields and click the &lt;strong&gt;green checkmark&lt;/strong&gt; to save.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; DNS propagation usually takes anywhere from a few minutes to a couple of hours. You can proceed with setting up the redirect rule right away while the changes sync across the web.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 3: Configure the Dynamic Redirect Rule
&lt;/h2&gt;

&lt;p&gt;While waiting for DNS to propagate, set up the routing logic inside Cloudflare.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your Cloudflare domain dashboard, go to the left sidebar menu.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Rules&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Redirect Rules&lt;/strong&gt; (or &lt;strong&gt;Page Rules&lt;/strong&gt; depending on your account view, though modern Cloudflare accounts use &lt;strong&gt;Redirect Rules&lt;/strong&gt; under Single Redirects).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set up the details like this:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting Field&lt;/th&gt;
&lt;th&gt;What to Select / Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Rule Name&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Domain Forwarding Redirect&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;When incoming requests match...&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Select &lt;strong&gt;All incoming requests&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Target URL Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Select &lt;strong&gt;Dynamic&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Expression&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;concat("[https://snapseek.app](https://snapseek.app)", http.request.uri.path)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Status Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;301 - Permanent Redirect&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Preserve query string&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Checked&lt;/strong&gt; / Enabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Order&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;First&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  How the Expression Works Under the Hood
&lt;/h2&gt;

&lt;p&gt;The key to keeping deep links intact is the dynamic expression:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;concat("https://snapseek.app", http.request.uri.path)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of sending everyone strictly to your home page, this snippet tells Cloudflare to read the exact path requested on the old domain and attach it directly onto the new destination.&lt;/p&gt;

&lt;p&gt;Combined with &lt;strong&gt;Preserve query string&lt;/strong&gt;, visitor links translate seamlessly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;http://snapseek.co/about&lt;/code&gt; redirected to &lt;code&gt;https://snapseek.app/about&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;https://snapseek.co/search?q=test&lt;/code&gt; redirected to &lt;code&gt;https://snapseek.app/search?q=test&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By letting Cloudflare manage your DNS and SSL termination, you completely bypass Namecheap's HTTPS limitation at zero cost. Every request coming into your legacy domain, regardless of protocol, subpath, or URL parameters, safely lands on your target destination.&lt;/p&gt;

</description>
      <category>dns</category>
      <category>domain</category>
      <category>webdev</category>
      <category>https</category>
    </item>
    <item>
      <title>How I Cut Web Upload Payloads by 90% Using a Client-Side Canvas Compression Loop</title>
      <dc:creator>Ashwin</dc:creator>
      <pubDate>Mon, 13 Jul 2026 16:41:26 +0000</pubDate>
      <link>https://dev.to/ashwin7/how-i-cut-web-upload-payloads-by-90-using-a-client-side-canvas-compression-loop-30ha</link>
      <guid>https://dev.to/ashwin7/how-i-cut-web-upload-payloads-by-90-using-a-client-side-canvas-compression-loop-30ha</guid>
      <description>&lt;p&gt;Imagine you are at a crowded wedding venue or a tech conference. The cellular network is crawling, and the venue Wi-Fi is congested. The event host or photographer wants to upload hundreds of high-res photos to &lt;a href="https://snapseek.app" rel="noopener noreferrer"&gt;SnapSeek AI event platform&lt;/a&gt; so guests can scan a QR code and instantly find their photos using facial recognition.&lt;/p&gt;

&lt;p&gt;But there is a massive bottleneck: uploading a photographer's raw JPEGs or an iPhone’s 12MB files over terrible network conditions means constant spinning, timing out, and failing.&lt;/p&gt;

&lt;p&gt;When building an event-app that relies on instant AI processing, network conditions and payload sizes are your worst enemies. Massive payloads lead to upload failures, frustrated users, and high backend memory spikes trying to run facial recognition models on uncompressed files.&lt;/p&gt;

&lt;p&gt;To solve this, I built a highly aggressive, intelligent client-side image processing pipeline using the native HTML5 Canvas API. It strictly caps image payloads to &amp;lt;1MB, resulting in a 75% to 90%+ reduction in upload sizes, zero perceived drop in quality, and rock-solid upload reliability on terrible networks.&lt;/p&gt;

&lt;p&gt;Here is exactly how the algorithm works.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Tech Stack: Staying Native
&lt;/h2&gt;

&lt;p&gt;Instead of bloating the bundle size with heavy third-party compression libraries, the optimization relies entirely on the browser's native capabilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In-Memory Elements:&lt;/strong&gt; Image objects and &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; elements are spun up entirely in memory (&lt;code&gt;document.createElement('canvas')&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format Normalization:&lt;/strong&gt; A helper function detects and converts non-JPEG files (&lt;code&gt;.heic&lt;/code&gt;, &lt;code&gt;.heif&lt;/code&gt;, &lt;code&gt;.png&lt;/code&gt;, &lt;code&gt;.webp&lt;/code&gt;) into standard &lt;code&gt;image/jpeg&lt;/code&gt; before feeding them to the canvas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Canvas native export:&lt;/strong&gt; It leverages &lt;code&gt;canvas.toBlob(callback, 'image/jpeg', quality)&lt;/code&gt; to handle the native binary encoding.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Core Optimization Loop
&lt;/h2&gt;

&lt;p&gt;Instead of just applying a static resize rule (which can ruin high-res photos or fail to shrink heavy files), the algorithm uses a smart initial scale followed by a strict, iterative fallback loop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: The "Smart" Initial Scale
&lt;/h3&gt;

&lt;p&gt;Before running any loops, the script estimates a safe starting size based on the area ratio of the target size (1MB) versus the current file size.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Calculate a safe initial bounding scale&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currentScale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;targetBytes&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;fileSize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;1.45&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This math gives us a realistic starting point so the browser doesn't waste CPU cycles iterating through a 15MB file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: The Quality &amp;amp; Dimension Step-Down Loop
&lt;/h3&gt;

&lt;p&gt;If the initial scale still yields a file larger than 1000 KB (1MB), a loop initiates. The algorithm has &lt;strong&gt;25 attempts&lt;/strong&gt; to get the file under 1MB using two levers: &lt;strong&gt;Quality&lt;/strong&gt; and &lt;strong&gt;Dimensions&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lever 1 (Quality Degradation):&lt;/strong&gt; It starts at JPEG quality &lt;code&gt;0.85&lt;/code&gt;. If the blob is &amp;gt;1MB, it steps down the quality by &lt;code&gt;0.15&lt;/code&gt; decrements down to a floor of &lt;code&gt;0.3&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lever 2 (Dimension Downscaling):&lt;/strong&gt; If the quality floor (&lt;code&gt;0.3&lt;/code&gt;) is reached and the file is &lt;em&gt;still&lt;/em&gt; too large, it keeps the quality low but begins shrinking the physical layout, multiplying width and height by &lt;code&gt;0.8&lt;/code&gt; on each subsequent step.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To the human eye, a compressed 1MB JPEG looks virtually identical to an 8MB HEIC on a mobile screen, but to a congested cellular tower, it’s the difference between success and a network timeout.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;p&gt;By enforcing this boundary &lt;em&gt;before&lt;/em&gt; pushing the upload to our S3 presigned URLs, we saw massive performance gains:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Before Optimization&lt;/th&gt;
&lt;th&gt;After Optimization&lt;/th&gt;
&lt;th&gt;Improvement&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Avg. Payload Size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;5MB – 12MB+ (HEIC/PNG/Raw)&lt;/td&gt;
&lt;td&gt;&amp;lt; 1,000 KB (1MB)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;75% to 90%+ reduction&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Upload Success Rate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High failure rate on venue Wi-Fi&lt;/td&gt;
&lt;td&gt;Near-flawless execution&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Massive UX Win&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI Facial Recognition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High memory spikes, slower inference on bloated files&lt;/td&gt;
&lt;td&gt;Blazing-fast facial scanning, highly predictable payloads&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Lower infrastructure cost &amp;amp; instant guest match&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Backend Safety Net
&lt;/h3&gt;

&lt;p&gt;As a rule of thumb in web development: &lt;em&gt;Never trust the client.&lt;/em&gt; While the frontend handles 99% of the heavy lifting, if an asset somehow bypasses the client-side check, the &lt;a href="https://snapseek.app" rel="noopener noreferrer"&gt;photo sharing app with face recognition&lt;/a&gt; backend acts as a strict safety net. It runs a parallel normalization process targeting a &lt;strong&gt;2MB&lt;/strong&gt; ceiling using a similar quality reduction loop, ensuring our storage and processing pipelines are never compromised.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You don't always need a heavy npm package or an expensive cloud-computing worker to optimize media delivery. By utilizing the user's browser canvas and a smart mathematical fallback loop, you can deliver lightning-fast web experiences even in the most network-congested environments.&lt;/p&gt;

&lt;p&gt;Have you built a custom client-side compression tool, or do you rely on backend workers?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>showdev</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
