L
L
lekam2020-05-31 20:32:03
System administration
lekam, 2020-05-31 20:32:03

How to make a link to a local resource if the server is behind Cloudflare?

There is a radio station website, which is located on the home computer, there is a white IP and a router that Iptables can do. Cloudflare is used to hide the real IP. Cloudflare addresses forwarded on the router to the local server.
As a result, the site works, but the broadcast does not. The player looks like this:

<audio >
  <source src="https://example.com:8000/audio" >
</audio>

If you replace it with <source src="https://192.168.0.100:8000/audio" >something inside the LAN works.
iptables is configured like this:
iptables -A PREROUTING -t nat -i eth1 -s <CF IP> -p tcp --dport https -j DNAT --to 192.168.0.100:443
iptables -A FORWARD -p tcp -d 192.168.0.100 --dport https -j ACCEPT
iptables -A PREROUTING -t nat -i eth1 -s <CF IP> -p tcp --dport 8000 -j DNAT --to 192.168.0.100:8000
iptables -A FORWARD -p tcp -d 192.168.0.100 --dport 8000 -j ACCEPT


How to access audio stream from outside?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-06-01
@lekam

Why not use port 443 and configure proxying (nginx) on the web server with the site.

<audio >
  <source src="https://example.com/audio" >
</audio>

location ^~ /audio {
        proxy_pass https://192.168.0.100:8000/audio;
        proxy_read_timeout 3600;
        proxy_redirect off;
        proxy_request_buffering off;
        proxy_pass_header   Server;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        send_timeout 3600;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question