-
Notifications
You must be signed in to change notification settings - Fork 263
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 config option to specify additional headers for serve #322
Conversation
138d7cb
to
0e98114
Compare
Is there any update on this? |
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.
One nit (which CI should have caught, we'll update later). Will be g2g after that.
src/serve.rs
Outdated
@@ -19,6 +19,8 @@ use crate::common::SERVER; | |||
use crate::config::RtcServe; | |||
use crate::proxy::{ProxyHandlerHttp, ProxyHandlerWebSocket}; | |||
use crate::watch::WatchSystem; | |||
use axum::http::header::HeaderName; | |||
use std::collections::HashMap; |
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.
Let's move these imports up to where their other related imports take place. axum::http::
is already being imported, so let's group those. Then for std::collections::HashMap
, let's move that up to line 1 (alphabetical order).
Thanks for the review. Unfortunately the changes have become pretty stale. I rebased and needed to completely change up the implementation. It works with the new This time I ran rustfmt, so the imports should be in the correct order :) |
Hi, @thedodd. Is anything blocking this PR? I also faced #414 in my project. I overlooked this PR and even prepared my own. (available here, the approach is slightly different, I also updated docs and added an example) I'd love to see this merged and released. It's quite a simple feature that helps tremendously. |
I also would love to see this merged. It looks like GitHub is saying that this branch is out-of-date with the base branch. I'll be willing to try to rebase it to the master and make other changes if needed. |
Rebased to the latest |
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.
Very last tiny item! I'll push the merge button on this once it is done.
Thanks again for all of the great work on this.
CHANGELOG.md
Outdated
@@ -40,6 +40,7 @@ Subheadings to categorize changes are `added, changed, deprecated, removed, fixe | |||
- It is now possible to disable the hashes in output file names with the new `--filehash` flag (for example `cargo build --filehash false`). Alternatively the `build.filehash` setting in `Trunk.toml` or the env var `CARGO_BUILD_FILEHASH` can be used. | |||
- Flags for enabling reference types & weak references in `wasm-bindgen`. | |||
- Added the `data-typescript` attribute to Rust assets. When present, `wasm-bindgen` will emit TS files for the WASM module. | |||
- Added `headers` config option for `trunk serve`. |
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.
We should add this to the unreleased section of the changelog. Once we are ready to cut a release, it will get moved down into a specific release version.
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.
Good catch that the automerge resulted in this artifact. Fixed.
Thanks for this PR. Look forward to its progress. |
Are there any updates on the possibility of merging this to the upstream? |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
I merged this into It would be great if any of you could test this feature specifically. You need to install |
I tested trunk-ng and it seems to work just fine. I can't tell a difference in behaviour between my branch and trunk-ng. |
This is now released with |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR is not stale. The feature is used by several people and has even been integrated into trunk-ng. |
This was brought back to trunk with PR #623 and it should be part of the next release of trunk too. |
This was released with trunk 0.18.0. |
I'm using webworkers (based on #285) and want to use
SharedArrayBuffer
. That requires setting the headersCross-Origin-Opener-Policy: same-origin
andCross-Origin-Embedder-Policy: require-corp
. To allow this configuration during development withtrunk serve
, I added a config option which allows specifying any number of header-value pairs, which are included in responses.Fix #414
Checklist
site
content with pertinent info (may not always apply).