proxying address in url param
This commit is contained in:
parent
8cd8a5ab4d
commit
3fabbe0fec
|
@ -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);
|
||||||
},
|
},
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue