proxying address in url param

This commit is contained in:
Adam 2023-09-06 18:30:26 -05:00
parent 8cd8a5ab4d
commit 3fabbe0fec
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -3,11 +3,14 @@ server {
server_name _; server_name _;
server_name_in_redirect off; server_name_in_redirect off;
resolver 127.0.0.11;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug; error_log /var/log/nginx/error.log debug;
location /service { location /service {
proxy_pass http://192.168.2.214:3000/; proxy_method GET;
proxy_pass $arg_url;
proxy_hide_header Access-Control-Allow-Origin; proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Origin $http_origin;
} }