tobychui / zoraxy

A general purpose HTTP reverse proxy and forwarding tool. Now written in Go!
https://zoraxy.aroz.org
GNU Affero General Public License v3.0
3.1k stars 188 forks source link

Reverse proxy appears 404[HELP] #189

Closed allmors closed 5 months ago

allmors commented 5 months ago

What happened? Reverse proxy appears 404.]

Describe what have you tried If the reverse proxy address is not a public IP, it will be 404 image image

But my local service can be accessed normally image

The most intuitive one is zoraxy, which runs on 8005. If my reverse proxy points to 127.0.0.1:8005, then it will also appear 404. If I use the public IP + port, then it will be normal. image image

Describe the networking setup you are using Here are some example, commonly asked questions from our maintainers:

Additional context Add any other context or screenshots about the feature request here.

Morethanevil commented 5 months ago

Your request comes from the internet to your hostmachine and then in the docker container. 127.0.0.1, localhost points INSIDE the container., because Zoraxy runs inside the container. This is not a bug, this is normal. Your setup would work if it were not a container then localhost, 127.0.0.1 would be your host machine.

This is why it works with your public IP and port ☺️

tobychui commented 5 months ago

@allmors This is expected behavior when deploy inside docker. The solution is reverse proxy through the public ip address of your instance (assuming it is directly exposed to the internet with a public IP address). Good to see that you have already figure out the solution yourself!

If your problem have been resolved and you got no further questions, please close this issue.

allmors commented 5 months ago

@allmors This is expected behavior when deploy inside docker. The solution is reverse proxy through the public ip address of your instance (assuming it is directly exposed to the internet with a public IP address). Good to see that you have already figure out the solution yourself!

If your problem have been resolved and you got no further questions, please close this issue.

Well, I thought it would be like nginx proxy manager. Even if it is a container deployment, it can still use the host's loopback address.

If it is normal through the public network, then the port must be exposed, which feels a bit redundant.

Morethanevil commented 5 months ago

You can set a static IP for Zoraxy. This works too. Then you can use the static IP of Zoraxy and the port inside the container. You can find a little guide in the wiki

allmors commented 5 months ago

You can set a static IP for Zoraxy. This works too. Then you can use the static IP of Zoraxy and the port inside the container. You can find a little guide in the wiki

Thanks for your answers, I made a mistake

allmors commented 5 months ago

You can set a static IP for Zoraxy. This works too. Then you can use the static IP of Zoraxy and the port inside the container. You can find a little guide in the wiki

I forgot that the docker container has a network card docker0, because all projects are deployed by docker, I should not use 127.0.0.1, but the loopback address of docker0, such as 172.17.0.1 image image

If possible, you can refer to nginx proxy manger, which supports local host loopback address.