Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS support #18

Closed
kirillt opened this issue Apr 22, 2020 · 10 comments
Closed

CORS support #18

kirillt opened this issue Apr 22, 2020 · 10 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kirillt
Copy link

kirillt commented Apr 22, 2020

I could be wrong, but it seems that this server doesn't support CORS out-of-the-box.
My guess is that it should be relatively simple to implement it with usage iron-cors.

@joseluisq joseluisq added the enhancement New feature or request label Apr 22, 2020
@joseluisq
Copy link
Collaborator

Yep, it's a missing feature right now but not hard to add. Maybe iron-cors-rs. PR welcome!

@joseluisq joseluisq self-assigned this May 4, 2020
@joseluisq joseluisq added this to the v1.9.0 milestone May 4, 2020
@joseluisq
Copy link
Collaborator

FYI this features is in progress now and will be available on next release.

@kirillt
Copy link
Author

kirillt commented May 4, 2020

Wow, great! Thank you. I also observed some minor issue with building it on Alpine (for very lightweight docker images), but I don't understand what is the culprit. It has something to do with rust bindings to openssl. Finally, I managed to build rust-openssl with this recipe: gnzlbg/ctest#95 But even after this I couldn't succeed to build this repo on Alpine.. It's really only if you are curious, since it is possible to just use another base image.

@joseluisq
Copy link
Collaborator

I didn't get it, do you want to build the whole project using Alpine? It would be interesting specially to save bytes but I have not tried it out with it.

As you probably know, this project uses a relative big image which is based on debian:buster-slim for a "convenient way" to cross-compile this project (Linux/Darwin).
Yes, you need build openssl and set up it around the system and probably you also want to take a look at https://github.com/joseluisq/rust-linux-darwin-builder/blob/master/docker/Dockerfile.

@kirillt
Copy link
Author

kirillt commented May 4, 2020

I wanted to build static-web-server only to have it's binary in a fixed environment. I was building rust-openssl because errors in build log were pointing at it. So, after I managed to compile it alone with non-packaged Rust and x86_64-unknown-linux-musl target, I hoped that static-web-server will compile also with the same toolchain, but this didn't happen.

Alpine just makes it a bit complicated with packaging only musl as a C library. I think, it is worth to spend time for this issue only out of perfectionism. On the other hand, simple-http-server can be compiled even with default Rust package there. I'm not sure how they made it possible.

I think I try to build it one more time later, just to get the error message at least.

@joseluisq
Copy link
Collaborator

joseluisq commented May 4, 2020

If you intention is not to just copy the binary from the scratch image, it would be interesting, just going on... 😅
I'm also interested in such exploration in pro not only of this tool. That's for sure.
By the way, I will try to find time to play around with that.

@kirillt
Copy link
Author

kirillt commented May 6, 2020

Super, thanks!

@joseluisq
Copy link
Collaborator

v1.9.0 released.

@kirillt
Copy link
Author

kirillt commented May 28, 2020

Actually, I realized only now that you upload Docker images of this server to Docker Hub.
It's much easier to use it than to build complete project in Alpine :) Thanks a lot!

@joseluisq
Copy link
Collaborator

Yeah, since the first version. Makes more sense because I use it to serve several sites in production.
Actually there are two images, the scratch that you can easily extend it and the Alpine as well. Both have just the static binary.

Enjoy it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants