<?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: chintanpuggalok</title>
    <description>The latest articles on DEV Community by chintanpuggalok (@chintanpuggalok).</description>
    <link>https://dev.to/chintanpuggalok</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1241431%2Fe4e22113-79a3-4d18-b4f7-71288418663d.jpeg</url>
      <title>DEV Community: chintanpuggalok</title>
      <link>https://dev.to/chintanpuggalok</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chintanpuggalok"/>
    <language>en</language>
    <item>
      <title>How twitter.com Redirects to x.com (The Magic Behind URL Forwarding)</title>
      <dc:creator>chintanpuggalok</dc:creator>
      <pubDate>Sun, 29 Dec 2024 04:57:57 +0000</pubDate>
      <link>https://dev.to/chintanpuggalok/how-twittercom-redirects-to-xcom-the-magic-behind-url-forwarding-2ekm</link>
      <guid>https://dev.to/chintanpuggalok/how-twittercom-redirects-to-xcom-the-magic-behind-url-forwarding-2ekm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered how twitter.com redirects to x.com? Let's explore this fascinating process using our browser's network console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5fy5j5smp81fdg1zafe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5fy5j5smp81fdg1zafe.png" alt="Initiator chain of twitter.com" width="800" height="140"&gt;&lt;/a&gt;As you can see, the request starts from twitter.com and then gets redirected to x.com")&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1k9gnv1y4qxmba8iehp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1k9gnv1y4qxmba8iehp.png" alt="Network console" width="800" height="337"&gt;&lt;/a&gt;twitter.com redirects to x.com with a status code of 302")&lt;/p&gt;

&lt;p&gt;When you visit twitter.com, it first responds with a 302 status code and then redirects to x.com. This process is known as URL forwarding.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is URL Forwarding?
&lt;/h2&gt;

&lt;p&gt;URL forwarding refers to the act of redirecting from one URL (e.g., url1.com) to another URL (e.g., url2.com).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fchintanpuggalok%2Fchintanpuggalok%2Fmain%2Fcontent%2Fblogs%2Furl_forwarding%2Fhttpredirect.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fchintanpuggalok%2Fchintanpuggalok%2Fmain%2Fcontent%2Fblogs%2Furl_forwarding%2Fhttpredirect.svg" alt="Image depicting URL forwarding" width="978" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections" rel="noopener noreferrer"&gt;Learn more about HTTP Redirections on MDN Web Docs&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of URL Forwarding
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Temporary Forwarding
&lt;/h3&gt;

&lt;p&gt;Temporary forwarding is used during site maintenance or downtime. It uses HTTP code 302.&lt;/p&gt;

&lt;h3&gt;
  
  
  Permanent Forwarding
&lt;/h3&gt;

&lt;p&gt;Permanent forwarding uses HTTP code 301. It is used to preserve existing links/bookmarks after changing the site's URLs, progress pages when uploading a file, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Personal Experience with URL Forwarding
&lt;/h2&gt;

&lt;p&gt;I encountered URL forwarding when setting up x.chintanpuggalok.com to forward to x.com/chintanpuggalok. (DM me if you read this :;)&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Set Up URL Forwarding Across Different Domains
&lt;/h2&gt;

&lt;p&gt;Here is how you can set up URL forwarding for different domain registrars:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Porkbun&lt;/strong&gt;: &lt;a href="https://kb.porkbun.com/article/39-how-to-set-up-url-forwarding" rel="noopener noreferrer"&gt;How to set up URL forwarding&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Namecheap&lt;/strong&gt;: &lt;a href="https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-to-set-up-a-url-redirect-for-a-domain/" rel="noopener noreferrer"&gt;How to set up a URL redirect for a domain&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare&lt;/strong&gt;: &lt;a href="https://developers.cloudflare.com/rules/page-rules/how-to/url-forwarding/" rel="noopener noreferrer"&gt;How to set up URL forwarding&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Understanding URL forwarding is crucial for web developers and site administrators. It ensures seamless user experience and preserves SEO value when URLs change. Whether it's temporary or permanent, knowing how to set up URL forwarding can be highly beneficial.&lt;/p&gt;

</description>
      <category>network</category>
    </item>
    <item>
      <title>Implementing Context Propagation in Reactive Programming Projects 🔄</title>
      <dc:creator>chintanpuggalok</dc:creator>
      <pubDate>Tue, 06 Feb 2024 16:57:24 +0000</pubDate>
      <link>https://dev.to/chintanpuggalok/implementing-context-propagation-in-reactive-programming-projects-2gcc</link>
      <guid>https://dev.to/chintanpuggalok/implementing-context-propagation-in-reactive-programming-projects-2gcc</guid>
      <description>&lt;p&gt;Learn how to seamlessly propagate context through a reactive stream in your project using Project Reactor, an essential skill for modern Java developers working with reactive programming models.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Mono&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;DemoClass&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;demoClassMono&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Mono&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;just&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;demoObject&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// Add context to MDC (Mapped Diagnostic Context) for logging purposes on each signal 📋&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;doOnEach&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;logUtil&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addToMdc&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getContextView&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
    &lt;span class="o"&gt;})&lt;/span&gt;
    &lt;span class="c1"&gt;// Transform the Mono stream by applying a function to each item emitted 🔄&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;demoClassMono1&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"inside main post init {}"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;demoClassMono1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;another&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;anotherDemoProcess&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;demoClassMono1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;})&lt;/span&gt;
    &lt;span class="c1"&gt;// Write context information by adding header details to the Reactor context ✍&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contextWrite&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;putAllMap&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;headerDetails&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Concepts Explained 🔑
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;.doOnEach((signal) -&amp;gt; {...})&lt;/code&gt;&lt;/strong&gt;: This operator allows for side-effects, such as logging, to be performed for each signal (onNext, onError, onComplete) in the stream. Utilizing &lt;code&gt;logUtil.addToMdc(signal.getContextView())&lt;/code&gt; ensures that every emitted item enriches the Mapped Diagnostic Context (MDC), making it easier to trace and debug reactive chains. 📊&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;.contextWrite(context -&amp;gt; {...})&lt;/code&gt;&lt;/strong&gt;: By leveraging this operator, developers can modify the context propagated down the stream. Adding key-value pairs from the &lt;code&gt;headerDetails&lt;/code&gt; map into the Reactor context with &lt;code&gt;context.putAllMap(headerDetails)&lt;/code&gt; is a powerful way to include essential metadata, like request IDs or user tokens, throughout the reactive pipeline. 🔧&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why It Matters in Reactive Programming 🌟
&lt;/h3&gt;

&lt;p&gt;Understanding and implementing context propagation in reactive programming is pivotal for maintaining a clear and traceable execution flow, especially in complex, asynchronous systems. These techniques improve debugging, logging, and the management of metadata across asynchronous boundaries, enhancing the overall reliability and maintainability of applications built with Project Reactor.&lt;/p&gt;

&lt;p&gt;here is a Git repo for an example&lt;br&gt;
&lt;a href="https://github.com/chintanpuggalok/context-propagation-project-reactor" rel="noopener noreferrer"&gt;Git repo for context propagation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>reactor</category>
      <category>springboot</category>
      <category>webflux</category>
    </item>
  </channel>
</rss>
