<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cors on Lloyd Rochester's Geek Blog</title><link>https://lloydroc.github.io/tags/cors/</link><description>Recent content in Cors on Lloyd Rochester's Geek Blog</description><generator>Hugo</generator><language>en</language><copyright>Copyright © 2025, Lloyd Rochester.</copyright><lastBuildDate>Fri, 05 Jul 2019 07:40:01 +0000</lastBuildDate><atom:link href="https://lloydroc.github.io/tags/cors/index.xml" rel="self" type="application/rss+xml"/><item><title>Enable CORS when not Supported</title><link>https://lloydroc.github.io/post/networking/nginx-cors-proxy/</link><pubDate>Fri, 05 Jul 2019 07:40:01 +0000</pubDate><guid>https://lloydroc.github.io/post/networking/nginx-cors-proxy/</guid><description>&lt;p>Some services don&amp;rsquo;t support &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">CORS&lt;/a>, but we can use NGINX to make CORS supported with this simple hack! To enable CORS on any service we need to have NGINX configured as a &lt;a href="https://lloydroc.github.io/post/networking/couchdb-nginx-proxy/">Reverse Proxy&lt;/a> and have NGINX add a successful pre-flight response to the CORS pre-flight request. Read on to get this simple example to work.&lt;/p>
&lt;p>Let&amp;rsquo;s back all the way up on why CORS is needed? Security! What if we could write Javacript on a server somewhere and that Javascript could use any back-end server it wanted for requests? That would introduce huge security vulnerabilities. For example, I could write a webpage that looks like a store, but not have a back-end for the store at all and send bogus orders to another store somewhere else on the internet that my site isn&amp;rsquo;t affiliated with. CORS gives us security that a front-end and back-end match up. From the back-end we can control what front-end has access to the back-end and also what requests that front-end can make.&lt;/p></description></item></channel></rss>