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>
$(function() {
$.ajax({
url: 'http://localhost:8080/service',
url: 'http://localhost:8080/service?url=http://192.168.2.214:3000/',
success: res => {
$('#response').text(res);
},

View File

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