LibreTranslate / LibreTranslate

Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup.
https://libretranslate.com
GNU Affero General Public License v3.0
8.33k stars 778 forks source link

Help with accessing on local network #65

Closed cbc02009 closed 3 years ago

cbc02009 commented 3 years ago

Very sorry if this is obvious stuff, but I have no experience with web APIs and I could use some help.

I have LibreTranslate running successfully in an LXC container on my home server, and from within the lxc it responds to curl -X GET "localhost:5000/frontend/settings" -H "accept: application/json" fine, but when I try to send a request to it from another computer on the network I get :

root@Ubuntu:~$ curl -X GET "10.0.0.33:5000/frontend/settings" -H  "accept: application/json"
curl: (7) Failed to connect to 10.0.0.33 port 5000: Connection refused

How can I make LibreTranslate available to my local network (but not the internet)?

I'm sure this isn't a LibreTranslate specific issue, but I wasn't sure where else to ask for help. If anyone could point me towards a guide (or even just what to google to find a guide) I would be super appreciative.

cbc02009 commented 3 years ago

Solution was to use nginx and proxy_pass as per the documentation here: https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ and https://serverfault.com/questions/536576/nginx-how-do-i-forward-an-http-request-to-another-port.

pierotofy commented 3 years ago

Glad you figured it out! Thanks for sharing the answer.