<?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: anand chaudhary</title>
    <description>The latest articles on DEV Community by anand chaudhary (@anakshiant).</description>
    <link>https://dev.to/anakshiant</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%2F280362%2F917975ae-d712-48fb-944a-6fa317def862.jpeg</url>
      <title>DEV Community: anand chaudhary</title>
      <link>https://dev.to/anakshiant</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anakshiant"/>
    <language>en</language>
    <item>
      <title>Web UI automation on cloud for QA and developers ☺️</title>
      <dc:creator>anand chaudhary</dc:creator>
      <pubDate>Sun, 14 Jun 2020 12:47:44 +0000</pubDate>
      <link>https://dev.to/anakshiant/web-ui-automation-on-cloud-for-qa-and-developers-4fd</link>
      <guid>https://dev.to/anakshiant/web-ui-automation-on-cloud-for-qa-and-developers-4fd</guid>
      <description>&lt;p&gt;Hello all.&lt;/p&gt;

&lt;p&gt;I am here for a survey about a product please submit your thoughts. Thank you. 😊 🙏 ❤️🙈.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://survey.anakshiant.xyz/"&gt;https://survey.anakshiant.xyz/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>UNDERSTANDING CORS</title>
      <dc:creator>anand chaudhary</dc:creator>
      <pubDate>Sun, 03 May 2020 14:55:16 +0000</pubDate>
      <link>https://dev.to/anakshiant/understanding-cors-2n26</link>
      <guid>https://dev.to/anakshiant/understanding-cors-2n26</guid>
      <description>&lt;p&gt;At the initial stage any developer whether one is .net ,php, node or python developer face a common problem that would be.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm6zp877v59bz780ucytt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm6zp877v59bz780ucytt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let's understand CORS and how we should use it to make you app secure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CORS&lt;/strong&gt; Cross-Origin Resource Sharing is a mechanism which blocks unwanted client side scripts to access resources on a server with the help of some http headers.&lt;/p&gt;

&lt;p&gt;Now suppose a client host &lt;code&gt;http://example-a&lt;/code&gt; makes an &lt;code&gt;XMLHttpRequest&lt;/code&gt; to &lt;code&gt;http://example-b&lt;/code&gt; browser would complain about missing &lt;code&gt;Acess-Conrol-Allow-Origin&lt;/code&gt; header on response and will block the client to access the response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frszjm0z6zwyopbqwbwcp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frszjm0z6zwyopbqwbwcp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now what happens on minimum level is if a client[&lt;a href="http://example-a" rel="noopener noreferrer"&gt;http://example-a&lt;/a&gt;] makes a request at server[&lt;a href="http://example-b" rel="noopener noreferrer"&gt;http://example-b&lt;/a&gt;].&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Request gets rejected if response header does not include &lt;strong&gt;Access-Control-Allow-Origin&lt;/strong&gt; header with the value either *&lt;em&gt;&lt;a href="http://example-a" rel="noopener noreferrer"&gt;http://example-a&lt;/a&gt; or * *&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Request is successfully completed if the header is present with appropriate value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now Which request gets blocked by server by &lt;em&gt;CORS policy&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invocations of the XMLHttpRequest or Fetch APIs, as discussed above.&lt;/li&gt;
&lt;li&gt;Web Fonts (for cross-domain font usage in @font-face within CSS)&lt;/li&gt;
&lt;li&gt;WebGL textures.&lt;/li&gt;
&lt;li&gt;Images/video frames drawn to a canvas using drawImage().&lt;/li&gt;
&lt;li&gt;CSS Shapes from images.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Headers
&lt;/h2&gt;

&lt;p&gt;There are multiple headers a server can specify to restrict client to access a resource on server.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Allow-Origin&lt;/strong&gt; tells the browser if current client should access the response for this request header's origin value shoudl be in Access-Control-Allow-Origin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Expose-Headers&lt;/strong&gt; the list of headers which be available to client by server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Max-Age&lt;/strong&gt; header indicates how long the results of a preflight request can be cached. For an example of a preflight request, see the above examples.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Allow-Credentials&lt;/strong&gt; if this header value is true and client makes request with &lt;strong&gt;credentials&lt;/strong&gt; - include. server can access cookies and http authentication header by client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Allow-Methods&lt;/strong&gt; the list of methods client can use to make request on server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access-Control-Request-Headers&lt;/strong&gt; the list of headers client can send to server. some headers are allowed by default. &lt;a href="https://fetch.spec.whatwg.org/#cors-safelisted-request-header" rel="noopener noreferrer"&gt; the list of headers which are allowed by default. &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Preflight Request
&lt;/h2&gt;

&lt;p&gt;"preflighted" requests first send an HTTP request by the OPTIONS method to the resource on the other domain, to determine if the actual request is safe to send. &lt;/p&gt;

&lt;p&gt;There are conditions when preflight request will not be made &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests" rel="noopener noreferrer"&gt; mention in detailed on mdn &lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All of these concepts has been demonstrated on this demo github repository using node js.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/anakshiant" rel="noopener noreferrer"&gt;
        anakshiant
      &lt;/a&gt; / &lt;a href="https://github.com/anakshiant/cors" rel="noopener noreferrer"&gt;
        cors
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Demo of CORS
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Cors ❌&lt;/h1&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;instructions&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;yarn&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;yarn start&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Concepts&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;&lt;code&gt; Repository  contains demo of following  concepts&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How a cors request can be allowed on server.&lt;/li&gt;
&lt;li&gt;Demonstration of preflight request&lt;/li&gt;
&lt;li&gt;Which headers to allow on server to allow cookies from client.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;This repository contains a server and a client which communicate to each other to demonstrate the concept of CORS&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;One can get into this in more detailed manner via going to this link on MDN &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="nofollow noopener noreferrer"&gt;CORS - MDN&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/anakshiant/cors" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  Next ?
&lt;/h2&gt;

&lt;p&gt;MDN has this  &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" rel="noopener noreferrer"&gt;amazing documentation on &lt;strong&gt;CORS&lt;/strong&gt; one can look at.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ajax</category>
      <category>http</category>
    </item>
  </channel>
</rss>
