-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add option --baseurl to allow running behind a reverse proxy #50
Conversation
This branch has conflicts that must be resolved |
25d2561
to
ffbae85
Compare
@micwoj92 Rebased, also fixed redirect when uploading files. |
Thank you @vi , a screen-oriented text editor software application. |
I have now this merge request in my fork |
Is three a specific reason why this can't be upstreamed? |
src/main.rs
Outdated
@@ -209,6 +209,12 @@ fn main() { | |||
.long("open") | |||
.short("o") | |||
.help("Open the page in the default browser")) | |||
.arg(clap::Arg::with_name("baseurl") | |||
.short("b") | |||
.long("baseurl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.long("baseurl") | |
.long("base-url") |
src/main.rs
Outdated
@@ -429,6 +438,7 @@ struct MainHandler { | |||
compress: Option<Vec<String>>, | |||
try_file_404: Option<PathBuf>, | |||
upload_size_limit: u64, | |||
baseurl: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseurl: String, | |
base_url: String, |
Sorry for so late reply, just don't have much time to test. Please also rebase the code. |
Done. |
Thanks! |
Overriding base URL from
/
to other value modifies all links in directory listings to begin from custom location instead of just/
.This allows using simple-http-server behind a reverse proxy that maps only request from a website's "subdirectory" to simple-http-server.
Example nginx config snippet:
This pull request also includes #49.