adding readme file

This commit is contained in:
Adam 2023-09-06 20:26:52 -05:00
parent cf460a79f9
commit d8286281ff
2 changed files with 16 additions and 1 deletions

15
README.md Normal file
View File

@ -0,0 +1,15 @@
# CORS-Proxy-NGINX
## Proof of Concept
Static HTML page that uses ajax to request api respose from express service through nginx proxy. If the ajax requests
the api directly it should fail with a cors error. The api increments a number everytime the express server responds so
you should know that the cached version is being hit if the response does not increment
### Steps to run
1. Build the sample api project ```npm install```
1. start the sample api ```npm start```
1. Start the nginx docker container ```docker compose up```
2. Find local ip address ```ifconfig en0|grep inet|awk '{print $2}'```
3. Update ajax request in index.html to point to your docker container
4. Open index.html and refresh to verify value is not incrementing
5. Wait 15 seconds and value should increment

View File

@ -14,7 +14,7 @@ Response: <span id="response"></span>
<script>
$(function() {
$.ajax({
url: 'http://localhost:8080/service?url=https://google.com/',
url: 'http://localhost:8080/service?url=http://192.168.2.214:3000/',
success: res => {
$('#response').text(res);
},