Remote request refused (when launching with zero options)
What am I doing wrong here? The README.md says all clients are allowed if you don't add any options to the program invocation. But it seems to me like the binary is silently rejecting requests unless the base of the URL says localhost.
Works 1
laptop command line:
~/gopath/bin/imageproxy
Laptop browser:
http://localhost:8080/200/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
I see the image.
Works 2
Ubuntu Server:
~/gopath/bin/imageproxy
Ubuntu Server:
curl 'http://localhost:8080/200/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
2021/06/22 23:00:37 fetching remote URL: https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
2021/06/22 23:00:37 request: {Method:GET URL:https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png#200x200 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Accept:[image/*] User-Agent:[willnorris/imageproxy]] Body:<nil> GetBody:<nil> ContentLength:0 TransferEncoding:[] Close:false Host:www.google.com Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr: RequestURI: TLS:<nil> Cancel:<nil> Response:<nil> ctx:0xc0000360c8} (served from cache: false)
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
Does not work 1
Ubuntu Server:
~/gopath/bin/imageproxy
Laptop browser:
http://192.168.1.3:8080/200/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
Image is not displayed.
I get curl: (7) Failed to connect to 192.168.1.3 port 8080: Connection refused if I use curl. I get no output when executing sudo tcpdump | grep 8080
Does not work 2
Ubuntu Server:
~/gopath/bin/imageproxy
Ubuntu Server:
curl 'http://192.168.1.3:8080/200/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
curl: (7) Failed to connect to 192.168.1.3 port 8080: Connection refused
Other info
- If I use an SSH tunnel so that the browser, it works.
- If I run
nc -l 8080, the request is received correctly (so I doubt there are connectivity issues):
GET /200/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png HTTP/1.1
Host: 192.168.1.3:8080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,ru;q=0.8