etesync / etesync-web

An EteSync web client
https://www.etesync.com
GNU Affero General Public License v3.0
245 stars 29 forks source link

BUG: 400 wrong host name error with Nginx revrse proxy #183

Closed corch closed 3 years ago

corch commented 3 years ago

I have etesync running in gunicorn listening on port 8811, behind an nginx proxy which is listening on port 8810. My Nginx config is copied from https://github.com/etesync/server/wiki/Production-setup-using-Daphne-and-Nginx. When I try to sign in using etesync-web on my local machine using the python3 http.server, I get the following error:

"400 Found wrong host name. Got: "example.foo:8810" expected: "example.foo"

This type of error is normally associated with an incorrectly set or missing "proxy_set_header Host $host;" line in the nginx config, but this line is present in the config copied from the github example. I have tried messing around with this setting a bit, changing the value to a static string "example.foo", it doens't seem to change the behaviour one way or another.

The nginx access log shows the following when trying to log in:

x.x.x.x - - [20/Nov/2020:10:32:48 +1100] "OPTIONS /api/v1/authentication/login/ HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
x.x.x.x - - [20/Nov/2020:10:32:48 +1100] "POST /api/v1/authentication/login/ HTTP/1.1" 400 124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"

I don't think there's a problems in general with my etesync server, my phone can sync the calendar fine (address book I'm having issues with, that's what I wanted the web client to check).

I'm not sure what else to check or try. My best guess at this point is that the web client doesn't support using a non standard port for the web server for some reason? Or does not support using a reverse proxy at all?

tasn commented 3 years ago

I think it was fixed in 843b59a0ac1e2076a514b9c52fc5c6941b27dff0 (so part of v0.5.2). Are you using the latest version?

corch commented 3 years ago

I'm not 100% sure what version I have, I downloaded from https://pim.etesync.com/etesync-web.tgz on 11 November, the bug is still present there. I assume this is probably still 0.5.1 as that is what is showing as the most current release on the Github page. Where can I get 0.5.2?

tasn commented 3 years ago

Sorry, I was talking about the server, not the client. You are using a custom server, right? You need to make sure it's up to date.

corch commented 3 years ago

Right, sorry. Yes its a custom server. Upgraded server and problem solved, thanks.

tasn commented 3 years ago

Great! :)