http-server-rs / http-server Goto Github PK
View Code? Open in Web Editor NEWSimple and configurable command-line HTTP server
Home Page: https://crates.io/crates/http-server
License: Apache License 2.0
Simple and configurable command-line HTTP server
Home Page: https://crates.io/crates/http-server
License: Apache License 2.0
Description
Elaborate a bit on the feature you would like to have implemented on this project,
what does this feature brings to the project?
Why is this useful?
Why do we need this?
How should this work?
Steps on how to use this feature, what is the expected behavior?
Please provide as much detail as possible in order to have a fructiful
discussion on how to implement this.
Description
Capability to allow several origins, instead of providing wildcard (*
), a list of origins could be configured to be accepted
by the server.
When a request is gathered from the client, the origin is checked against the provided list and if such origin belongs
to the list, then the CORS Allow-Origin
header would have such origin settled as value.
Why is this useful?
This could help for serving files to multiple front-ends but not any
How should this work?
allowed_origins
list in the configuration fileallowed_origins
settingAccess-Control-Allow-Origin
header is set to such originAccess-Control-Allow-Origin
header is not included in the HTTP ResponseThis feature request was originally mentioned by @morenol in the following PR comment:
Description
File paths are templated into the html verbatim. Handlebars inserts html escape characters, but this doesn't handle things like filenames containing spaces correctly.
Steps to reproduce
touch 'file with spaces.txt'
files with spaces.txt
linkhttp://127.0.0.1:8080/files
, which returns a 404Environment
HTTP Server Version: v0.1.0
Operative System: Linux
Description
Implement support for CORS headers. By default this server will not provide CORS headers on responses.
Why is this useful?
CORS headers would allow arbitrary front-ends to request resources to an instance of this server.
By default websites doesn't allow cross origin requests.
By providing CORS headers front-ends will be able to make request to the server and load such resources.
For more details refer to: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
How should this work?
When running the HTTP server as:
http-server
Responses won't include any of CORS headers. Causing browsers to complain about missing
CORS headers when request are executed.
If the user runs the HTTP server specifying the cors
option with the correct values, such browser
will be able to load such resources.
# Specifies CORS headers Origin to be "*" with all methods allowed and all headers allowed
http-server --cors
# Specifies CORS headers for the provided URL as origin
http-server --cors https://www.mywebsite.com
For further configuration the TOML configuration file must be used.
[cors]
origin = "https://www.mywebsite.com"
methods = ["GET", "POST", "PUT", "DELETE"]
headers = ["Content-Type"]
max-age = 3400
It would be good to have a SECURITY.md document that isn't just a template.
Description
I tried to start this server on my two Windows machines (one runs Windows Server and the other runs Windows 10) and found that it could not access any files on both machines, any request to access files and directories (include /) returned status 403 with content Access declined. (os error 5)
.
Steps to reproduce
Environment
HTTP Server Version: v0.7.0
Operative System: Windows
Screenshots
N/A
Description
Provide github releases with binaries to download
Why is this useful?
Provides the ability to use the project without installing rust on the machine and then compiling it.
How should this work?
Upload binaries for linux/amd64 and possible other targets. These can be made with CI with some available GH actions workflows
Provides logging to stdout support.
The logger line info must include:
[2021-12-12T14:03:48.841116Z] "GET /favicon.ico HTTP/1.1 404 Not Found" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15"
Description
Like this:
Request from the front end: /api/something
To the backend API: localhost:8000/something
Requests should be forwarded to the backend (without the path prefix /api
)
Why is this useful?
It is useful in the most of the web applications 😄
Description
Support for Breadcrumb Navigation in the File Explorer's UI.
Example from Bootstrap: https://getbootstrap.com/docs/5.0/components/breadcrumb/#example
Why is this useful?
This would enhance UX by having shortcuts to travel to previous directories in the same path.
How should this work?
As a user I should be able to navigate deep into directories and click on certain breadcrumb parts to go back to previous directories without having to use the "Back" button from the browser.
./google-cloud-sdk/install.sh --help
It would be nice to have a HttpServer.toml
we could use to spin up server.
When running the server as:
http-server --config ./HttpServer.toml
The Configuration would be read on init to build server with desired configuration.
Cli
into a Config
structHttpServer.toml
and build a Config
from itWe need tracing to produce logs for debugging and monitoring.
Tracing is a library we can use given that is developed by Tokio,
the same organization behind Axum.
Description
On both Linux and Windows it cannot read any certificate and key files (standard RSA certificate and key in plain text which works properly with Nginx), prompting the provided certificate is empty.
I checked the code and found that maybe it is a problem with reading buffers. To both problems I have no clue until present, and can't determine whether it's a problem with the project or my environment.
Steps to reproduce
N/A
Environment
HTTP Server Version: v0.7.0
Operative System:
Screenshots
N/A
./google-cloud-sdk/install.sh
Description
Would like to define cors policy
{ "key": "Cross-Origin-Embedder-Policy", "value": "require-corp" },
{ "key": "Cross-Origin-Opener-Policy", "value": "same-origin" }
Why is this useful?
To run multithreaded web assembly using wasm_bindgen_ryon
Last row in the table is not completely visible
Steps to reproduce
Environment
HTTP Server Version: v0.8.6
Operative System: Windows
Screenshots
Notice that I completely scrolled down
Website Snapshot: https://mega.nz/file/J8cwSSyA#8ioa2D-nT8pyi_xn9lowMXP_WtPGR5NgrmHAJSwGam0
Capability to open the browser automatically with the --open
argument
it's built on linux just fine, but very hard to cross compile for windows from Linux, so I just installed rust on windows and start building, then it failed:
Compiling http-server v0.7.4 (C:\Users\Test\rust\http-server)
error[E0515]: cannot return value referencing local variable `bytes`
--> src\utils\url_encode.rs:50:13
|
39 | &bytes
| ------ `bytes` is borrowed here
...
50 | std::iter::once("/").chain(segment)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function
|
= help: use `.collect()` to allocate the iterator
For more information about this error, try `rustc --explain E0515`.
error: could not compile `http-server` due to previous error
warning: build failed, waiting for other jobs to finish...
When you just start the application, it prints nothing. You have no idea which port the app is on and which host it's hosted on. It is also much more practical to just click the link in the terminal than to manually write it in the browser.
So, why not make it verbose by default? New users won't get confused and others will save a couple keystrokes on -v.
Completely remove the -v
flag and instead add a -q
flag, which stands for quiet
When encountering directories we want to render an index of the directory files.
Axum has increased popularity lately, it would be nice to begin migrating this
solution to Axum.
Axum already provides compatibility with Tower middleware which is great given
that tower has a mature community, so most of the features can be built out of the box!
Description
I installed with cargo install
and followed the instructions in the readme to get TLS working. However, I'm getting the following errors:
Steps to reproduce
cargo install http-server
http-server --tls --tls-cert localhost.crt --tls-key localhost.key --tls-key-algorithm pkcs8
https://localhost:7878
in browserEnvironment
Linux
http-server 0.8.5
OpenSSL 3.1.1 30 May 2023 (Library: OpenSSL 3.1.1 30 May 2023)
./google-cloud-sdk/bin/gcloud init
Description
Theres some issues in relation to the File Explorer UI, most of them are related to padding, margin of some elements.
Steps to reproduce
Environment
HTTP Server Version: v0.3.4
Operative System: MacOS/Linux/Windows
Screenshots
Description
I tried to follow the readme: I ran cargo install http-server
. But then I couldn't run http-server
because no binary with that name was installed. Instead, the installed binary's name is main
.
% cargo --version
cargo 1.50.0 (f04e7fab7 2021-02-04)
% cargo install --list
http-server v0.3.0:
main
Environment
HTTP Server Version: v0.3.0
Operative System: macOS 11.3.1 on M1
The following list includes all todos to complete migration, on main
branch we still have Hyper version running which
is tagged as v0.x
.
gzip/deflate
Compressionbrotli
CompressionLast-Modified
and ETag
If-Modified-Since
Accept-Ranges
Content-Range
If-Range
If-Match
Range
Description
Implement capability to upload files, using HTTP POST
requests.
A POST
along with a file attached to the request body should create such file in the provided path.
Why is this useful?
Improve HTTP Server capabilities by enabling the user to create new files in the specific
How should this work?
curl -i -X POST host:port/:root-dir-relative-path \
-H "Content-Type: text/xml" \
--data-binary "@path/to/file"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.