rewriting cors header in proxy

This commit is contained in:
Adam 2023-09-06 16:53:20 -05:00
parent 2c9487c748
commit 8cd8a5ab4d
2 changed files with 3 additions and 1 deletions

View File

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

View File

@ -8,5 +8,7 @@ server {
location /service { location /service {
proxy_pass http://192.168.2.214:3000/; proxy_pass http://192.168.2.214:3000/;
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin $http_origin;
} }
} }