Roverr / rtsp-stream

Out of box solution for RTSP - HLS live stream transcoding. Makes RTSP easy to play in browsers.
MIT License
712 stars 167 forks source link

Web UI trying to connect to 127.0.0.1 #46

Open sshaikh opened 4 years ago

sshaikh commented 4 years ago

On the server I run docker run -p 80:80 -p 8080:8080 roverr/rtsp-stream:2-management.

I get the UI but the add button does nothing. On inspection it seems that it's trying to reach 127.0.0.1

MACscr commented 4 years ago

I am having the same issue. Not sure how to solve it.

ofadam commented 4 years ago

Same issue as well.

This appears to be the same issue as here: https://github.com/Roverr/rtsp-stream/issues/36

Roverr commented 4 years ago

Hi everyone,

Thanks for opening this issue!

The solution for this is to implement the building of the frontend when the docker image starts.

What does it mean? It means that whenever the docker image starts it builds the UI from scratch using the environment variables given to it. So ideally, when starting the image you would pass an RTSP_STREAM_BACKEND_URL variable which would tell the frontend what is the exact address of the backend.

Why does it work locally? Because on localhost of course you can access your system using this 127.0.0.1

How to achieve this? I need to make changes in how the image works. This would result in a bigger image, but I don't think it matters too much. However it is uncomfortable, as the current management image does not have Node in dependency.

When? Not sure at the moment. I have an ongoing project that eats up most of my time which ends in August. Hopefully I will be able to get back to this topic by then. However until that, feel free to create a PR please.

quaint-engineer commented 4 years ago

For a quick solution, I consoled into the container and ran find /ui -type f -exec sed -i 's/localhost:8080/<YOUR DOCKER MACHINE IP>:8080/g' {} \; find /ui -type f -exec sed -i 's/127.0.0.1:8080/<YOUR DOCKER MACHINE IP>:8080/g' {} \;. Then reboot the container. You may also need to clear your browser history after this change.

sshaikh commented 4 years ago

This was helpful! For those unfamiliar with docker, I used the following (sudos omitted):

docker ps #to find the name
docker exec -it <container-name> bash
find /ui -type f -exec sed -i 's/localhost:8080/10.10.0.6:8080/g' {} \;
find /ui -type f -exec sed -i 's/127.0.0.1:8080/10.10.0.6:8080/g' {} \;
exit
docker restart <container-name>

I haven't figured out how to persist this, but it's enough to test rtsp-stream - which works fabulously by the way.

hillbun commented 4 years ago

@Roverr

what is RTSP_STREAM_BACKEND_URL variable format?

is it http://10.10.0.6:8080/ ?

chunfeng-zhang commented 3 years ago

Hi everyone,

Thanks for opening this issue!

The solution for this is to implement the building of the frontend when the docker image starts.

What does it mean? It means that whenever the docker image starts it builds the UI from scratch using the environment variables given to it. So ideally, when starting the image you would pass an RTSP_STREAM_BACKEND_URL variable which would tell the frontend what is the exact address of the backend.

Why does it work locally? Because on localhost of course you can access your system using this 127.0.0.1

How to achieve this? I need to make changes in how the image works. This would result in a bigger image, but I don't think it matters too much. However it is uncomfortable, as the current management image does not have Node in dependency.

When? Not sure at the moment. I have an ongoing project that eats up most of my time which ends in August. Hopefully I will be able to get back to this topic by then. However until that, feel free to create a PR please.

You may use JS API window.location.href to get the host.

mmm8955405 commented 2 years ago

https post, How do I find it?

mmm8955405 commented 2 years ago

There are also cross domain requirements