<?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>Forem: kaishuu0123</title>
    <description>The latest articles on Forem by kaishuu0123 (@kaishuu0123).</description>
    <link>https://forem.com/kaishuu0123</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%2F434555%2Fbda36640-b791-4257-91f8-7162639a319a.jpg</url>
      <title>Forem: kaishuu0123</title>
      <link>https://forem.com/kaishuu0123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kaishuu0123"/>
    <language>en</language>
    <item>
      <title>CORS Reverse Proxy (cors-reverse-proxy)</title>
      <dc:creator>kaishuu0123</dc:creator>
      <pubDate>Sat, 18 Jul 2020 02:10:31 +0000</pubDate>
      <link>https://forem.com/kaishuu0123/cors-reverse-proxy-cors-reverse-proxy-7gd</link>
      <guid>https://forem.com/kaishuu0123/cors-reverse-proxy-cors-reverse-proxy-7gd</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/kaishuu0123/cors-reverse-proxy"&gt;https://github.com/kaishuu0123/cors-reverse-proxy&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker Hub: &lt;a href="https://hub.docker.com/r/kaishuu0123/cors-reverse-proxy"&gt;https://hub.docker.com/r/kaishuu0123/cors-reverse-proxy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Use Case
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;For local development environment etc.&lt;/li&gt;
&lt;li&gt;When you want to load resources (images, JS, etc.) while trusting a specific web application.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Motivation
&lt;/h1&gt;

&lt;p&gt;I wanted a docker image that would add a simple &lt;code&gt;Access-Control-Allow-Origin: *&lt;/code&gt; header.&lt;/p&gt;

&lt;p&gt;In addition, when I searched on the Internet, I could not find a reverse proxy that suits my purpose so much.&lt;br&gt;
So I made it while enjoying and studying the GO language.&lt;/p&gt;

&lt;p&gt;When doing web development, there are times when content loading is blocked due to CORS policy issues. If you have seen the following message in the developer console, I think that you have it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It's very correct, and it may be a necessary protection for security, but there are times when you do not want to be blocked after judging that there is no problem in development&lt;/p&gt;

&lt;p&gt;As a workaround, there are 2 patterns&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A case where &lt;code&gt;Access-Control-Allow-Origin: *&lt;/code&gt; Header is added by nginx or Apache&lt;/li&gt;
&lt;li&gt;Install the CORS related package to the middleware of the application and set it&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is a way to create a config file such as nginx or Apache and pass it as a container, but in the first place it is troublesome to prepare a config file just to give &lt;code&gt;Access-Control-Allow-Origin: *&lt;/code&gt; Header.&lt;/p&gt;

&lt;p&gt;So I developed this project.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>go</category>
    </item>
  </channel>
</rss>
