Answer the question
In order to leave comments, you need to log in
How to set up a tunnel (Proxying from vds to localhost)?
Hi all
, this is a question. There is an android application that I’m developing now, I’m testing it on my device,
I’m making an api that is on localhost, I can’t connect to my computer’s localhost from my device, so I was advised to make a tunnel
I bought vds installed nginx, I bought a domain
here are the nginx settings for the domain
upstream domain {
server 127.0.0.1:3001;
}
server {
listen 80;
server_name domain.ru;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://domain;
}
}
127.0.0.1 localhost
127.0.0.1 domain.loc
ebug1: Authentication succeeded (password).
Authenticated to domain.ru ([IP_Сервера]:22).
debug1: Remote connections from LOCALHOST:3001 forwarded to local address domain.loc:80
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: remote forward success for: listen 3001, connect domain.loc:80
debug1: All remote forwarding requests processed
Answer the question
In order to leave comments, you need to log in
If I understand everything correctly, then try replacing proxy_set_header Host $http_host; Or write in
your home nginx instead of (or in addition to) domain.loc - domain.ru
The bottom line is that your home server receives a request like
GET / /HTTP1.1
Host: domain.ru
server_name domain.loc;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question