asciimoo / morty

Privacy aware web content sanitizer proxy as a service
GNU Affero General Public License v3.0
484 stars 57 forks source link

Morty behind Nginx Reverse Proxy won´t work #95

Closed Happyfeet01 closed 4 years ago

Happyfeet01 commented 4 years ago

Hello

i have setup Searx in an Docker-Container and it works. But when i try to access Morty with the URL https://suche.dasnetzundich.de/morty i get an 502 Error. The Container is listen to 127.0.0.1:3000 also the Nginx Settings for Searx are correct. Can Anyone help me?

[error] 29070#29070: *543 connect() failed (111: Connection refused) while connecting to upstream, client: 54.36.xxx.xx, server: suche.dasnetzundich.de, request: "GET /morty/?mortyurl=https%3A%2F%2Fwww.domain-tld%2Fstore%2Fpc%2Fviewcontent.asp%3Fidpage%3D5 HTTP/2.0", upstream: "http://10.10.10.5:80/morty/?mortyurl=https%3A%2F%2Fwww.domain.tld%2Fstore%2Fpc%2Fviewcontent.asp%3Fidpage%3D5", host: "suche.dasnetzundich.de"

maxweisspoker commented 4 years ago

I ran into that exact same issue. It appears that the problem was created here:

https://github.com/asciimoo/morty/commit/a549f668b4cf8cf79320e252cd05f6a0f02191b8#diff-ba7688b9e1bd5a1ac02d41cb4a46feffL989

and the "-listen" command line parameter is being ignored. I don't know enough to parse through how the config works in order to create a pull request, but that's almost certainly what's going on. In the meantime, the fix that worked for me was setting the env var "MORTY_ADDRESS" to the listen address and port (e.g. "192.168.10.10:3000")

I think it's likely that the code for the config wasn't updated somewhere.

Edit: I looked at the code -- it's reasonably simple to see where "listen" is getting set, and for the life of me I don't see anything that looks clearly wrong. Obviously the CLI flag isn't being set, but I can't figure out why.

Edit 2: It looks like the flag options are being dereferenced. I don't know enough about Go to be sure that's wrong, but it seems likely to be the culprit to me.

Happyfeet01 commented 4 years ago

Yes that was the problem