rtsp-stream icon indicating copy to clipboard operation
rtsp-stream copied to clipboard

Web UI trying to connect to 127.0.0.1

Open sshaikh opened this issue 4 years ago • 9 comments

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

sshaikh avatar Jun 18 '20 16:06 sshaikh

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

MACscr avatar Jun 29 '20 15:06 MACscr

Same issue as well.

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

ofadam avatar Jul 03 '20 03:07 ofadam

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.

Roverr avatar Jul 20 '20 12:07 Roverr

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.

quaint-engineer avatar Jul 27 '20 20:07 quaint-engineer

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.

sshaikh avatar Jul 28 '20 15:07 sshaikh

@Roverr

what is RTSP_STREAM_BACKEND_URL variable format?

is it http://10.10.0.6:8080/ ?

hillbun avatar Aug 18 '20 08:08 hillbun

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.

chunfeng-zhang avatar Jan 03 '21 07:01 chunfeng-zhang

https post, How do I find it?

mmm8955405 avatar Aug 26 '22 03:08 mmm8955405

There are also cross domain requirements

mmm8955405 avatar Aug 26 '22 03:08 mmm8955405