java - Proxy server which listens and interprets to all http request on my machine -


i need mock http service running on different ports , ip address on linux system.

i have used embedded jetty server mock http services locally on system.

the problem statement having is:

http request system specific ip , port should redirected embedded jetty servers running on local system example:

request http://10.10.10.10:8443 ----should redirected ---> http://localhost:8443

one way of achieving adding entry in /etc/hosts file

10.10.10.10 localhost

but can't change system's /etc/hosts file , there other way achieve programmatic.

thanks in advance.

you put nginx on machine , listen on 8443 or port 80 , proxy connection localhost.

server {     # listen on port 80     listen 80;     listen 443 ssl;      # requests these domains     server_name 10.10.10.10;      # keep logs in these files     access_log /var/log/nginx/access.log;     error_log /var/log/nginx/error.log;      # ssl certificate     ssl_certificate     /etc/nginx/ssl/certs/nginx.crt;     ssl_certificate_key /etc/nginx/ssl/nginx.key;      # need allow users upload large files     # see http://wiki.nginx.org/httpcoremodule#client_max_body_size     # i\'m not sure goes, put in twice. works.     client_max_body_size 0;      location / {         proxy_pass http://localhost:8443;         proxy_redirect off;         proxy_read_timeout 5m;         # make sure these http headers set         proxy_set_header host            $host;         proxy_set_header x-real-ip       $remote_addr;         proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     } } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -