forem / selfhost

Selfhost your Forem Community on your own infrastructure 🎉
https://www.forem.com/get-started/
GNU Affero General Public License v3.0
1.43k stars 169 forks source link

Images not loading behind VPN #66

Closed manish-nference closed 2 years ago

manish-nference commented 2 years ago

Describe the bug When the host machine has 443 and 80 access to our VPN IP's .Text and everything is working fine. Images get uploaded but they don't show on the page. Once I whitelist 443 and 80 to the world, images starts loading.

I have used ansible script and using AWS for the same.

I am also attaching the screenshot of the errors:

Screenshot 2022-04-07 at 8 20 41 PM

Error for container imgproxy:

WARNING [2022-04-07T14:50:31Z] Completed in 5.000591964s /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n?i=i request_id=QeiphVP2f5CbLu0wUuna0 method=GET status=404 error="The image request timed out" INFO [2022-04-07T14:50:31Z] Started /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n request_id=dU7rTfyAvpxOhzf601AAh method=GET WARNING [2022-04-07T14:50:36Z] Completed in 5.002901923s /6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n request_id=dU7rTfyAvpxOhzf601AAh method=GET status=404 error="The image request timed out"

Logs for openresty:

127.0.0.1 - - [07/Apr/2022:14:45:01 +0000] "GET /images/6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n HTTP/1.1" 404 27 "{host}/newws-413n" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36" "ip-addr" "/images/6DQjwvTRTleSWBhfCREAbcPmlqS37kfcE3QQxSQH5Cg/w:880/mb:500000/ar:1/aHR0cHM6Ly9hc2su/bmZlcmVuY2UubmV0/L3VwbG9hZHMvYXJ0/aWNsZXMvZXV4Mmp3/bTdmOGtkZ3ozNzY2/cmUucG5n" "MISS"

jdoss commented 2 years ago

Hey there, thanks for trying out selfhost. This seems very weird and it is hard for me to troubleshoot this well with the information provided. Did you end up figuring out this problem or are you still having issues?

manish-nference commented 2 years ago

Hey @jdoss I was able to make it work. I had to whitelist the same server(on which I have my setup) public ip in the firewall[port 80]. But it seems strange to me if a connection is already inside it should not have to take the request to the ip again.

jdoss commented 2 years ago

Awesome. Thanks for the update. I think it is because the Forem code references images using the URL, but I am not 100% sure. I am glad you go this working. I am going to close this issue for now.