fxbox / registration_server

The registration server to help with foxbox discovery
4 stars 4 forks source link

Support CORS headers #13

Closed gmarty closed 8 years ago

gmarty commented 8 years ago

It seems that the registration server doesn't serve CORS headers.

It should have at least a Access-Control-Allow-Origin header.

arcturus commented 8 years ago

AFAIK, the registration server support CORS:

https://github.com/fxbox/registration_server/blob/master/src/routes.rs#L100

I think we could be hitting a problem caused by the tls proxy that @michielbdejong setup in port 4243.

@gmarty which registration URL are you using?

gmarty commented 8 years ago

The registration server doesn't seem to work for me anymore. Firefox fails silently (nothing in the network tab of dev tools) and Chrome shouts:

Fetch API cannot load https://knilxof.org:4243/ping. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
arcturus commented 8 years ago

That's weird, actually I don't think changes by @michielbdejong are causing any problem, I can see the request green on my firefox.

gmarty commented 8 years ago

With what command do you start the box?

arcturus commented 8 years ago

Ok, no problem with the proxy, we just need version matching for the registration process and the latest version of the registration server:

https://github.com/fxbox/foxbox/pull/201

michielbdejong commented 8 years ago

We discussed on irc that the TLS-offloading proxy that runs on port 4243 hides the client's remote IP address from the registration server, so the registration server will always record '127.0.0.1' as the public IP address, and pools everybody's Boxes and clients into one pool. This might be what caused the malfunction? An easy way to test is to undo https://github.com/fxbox/app/pull/12/files

ferjm commented 8 years ago

This was fixed by #14