Conversation
|
Thanks for submitting this! I hope Mozilla consider accepting it.
Personally, yes, I would like it if public_url also sets host, port and scheme if it is defined. If it's defined by config, the service should not need to guess from headers. I believe it's also the behaviour of the previous SyncServer-1.5. |
|
This is now broken by commit 3404150. Tried to use it so that I could get syncserver-rs to work properly. |
|
I think at time of writing you can just rebase it Gimme a sec |
c3895d3 to
54b9344
Compare
Built syncserver from this pull request, but sync still fails (logs from firefox, this is where it switches to localhost again):1762537347298 Sync.Status DEBUG Status.login: success.status_ok => success.login
|
|
To me, it looks like you're calling the sync server by Is this, by chance, what's going wrong? |
No, prefs.js in Firefox has same value, as public_url... And it initially connects public_url according the logs... Could it be, that syncserver sends it self url as a part of some response? That /4/ at the end... Configured url in firefox ends with 1.5 1762580651257 Services.Common.RESTRequest DEBUG GET https://public_server/ffsync/1.0/sync/1.5 200 |
Ok. tokenserver_rs database nodes table had localhost url in node field.. Changing it to public_url removes those http://localhosty:9000 requests.... |
That is probably caused by #1753 |
When running behind a reverse proxy hosting the service under a webroot other than `/` causes 401 error codes due to mismatching Message Authentication Codes (MACs). Changes made in this commit allow users hosting the sync server behind a reverse proxy to specify the `public_url` of their service in order to correct this behaviour. In doing so, changes made in this commit fix mozilla-services#1217, mozilla-services#1649
9448400 to
ca2d94c
Compare
Description
Currently, hosting the SyncStorage service under any root URL other than
/like, say,/firefox-sync, causes 401 HTTP error codes caused by mismatching Message Authentication Codes (or MACs for short) as pointed out by @ethowitz here.Changes made in this PR add a new option
public_urlallowing users to specify the public facing URL to the root of thesyncservers services.This
public_urloption is used for determining the original request uri and perform the MAC authentication properly.Things to Note
As explained by @kyz here, the host and port for performing the MAC authentication are taken from the
Forwardedor theX-Forwarded-ForandX-Forwarded-Schemeetc. headers:syncstorage-rs/syncserver/src/web/auth.rs
Lines 177 to 193 in 8c56cae
It might be a good idea to swap this to perform the authentication based on
public_urlif specified, instead. However, I did not include this in this PR and I would love to hear what other people think about this.Testing
syncserverwhich is hosted under a root other than/, for example:http://localhost:8080/firefox-sync:http://localhost:8080/firefox-sync/1.0/sync/1.5http://localhost:8080/firefox-sync/1.5/*fail with a 401 HTTP codeIssue(s)
Closes #1217 and closes #1649.