lukechampine / walrus

A wallet server for Sia
https://lukechampine.com/docs/walrus
MIT License
12 stars 0 forks source link

allow cross origin requests for web wallets #9

Closed n8maninger closed 4 years ago

n8maninger commented 4 years ago

Adds github.com/rs/cors and wraps the server mux to allow cross origin requests. This would be necessary to allow wallet.siacentral.com to access the endpoints.

lukechampine commented 4 years ago

thanks for the contribution!

I'm a bit torn on this, for two reasons:

I think the second argument is pretty strong. There's just one reason that I have doubts, which is that it's annoying for a new user to have to install NGINX in order to run walrus properly. The average user just wants to run the binary and start using the web wallet.

On the other hand... the "average user" will probably start out using a lite wallet like narwal, and I can easily add CORS support to my narwal server. So narwal will "just work" with web wallets. Graduating from narwal to a local walrus full node already requires the user to get their hands a little dirty, so adding CORS to that burden doesn't seem terrible.

I guess I should add a more thorough "setup" guide for running walrus in conjunction with NGINX. You definitely need to be using HTTPS if you plan to talk to your walrus instance remotely, for example.

So for now I think my position is, "let's add CORS to narwal, and also write a guide for running walrus properly, including HTTPS and CORS." If enough people complain about the NGINX requirement, we can revisit it.

lukechampine commented 4 years ago

I've added some setup instructions to the README. Going to close this for now, but I'm open to further discussion if you think CORS really should be supported in walrus itself.