request url example#73
Open
ruslanti wants to merge 5 commits into
Open
Conversation
…rgets - Improved example builds by specifying `--manifest-path` for clarity. - Scoped `ci.yaml` commands to `fastedge` and `fastedge-derive` packages.
- Introduced `http_wasi_print` example which logs request details and responds with method, URL, and headers. - Added `Cargo.toml` and `README.md` for the new example.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repo workspace to include all example crates (while keeping the core SDK as the default build), updates manifests to Rust 2024 edition with unique crate names, and adds new examples demonstrating request inspection (WASI) and request URL/property rewriting (CDN proxy-wasm).
Changes:
- Add new examples:
examples/http/wasi/print(WASI) andexamples/cdn/request_url(CDN proxy-wasm). - Convert examples into workspace members and rename example crates to avoid package-name collisions; bump editions to 2024.
- Adjust CI workflows to build/doc/clippy only SDK crates, and update the examples build workflow to build by
--manifest-path.
Reviewed changes
Copilot reviewed 55 out of 57 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| src/proxywasm/mod.rs | Marks the FFI extern block as unsafe extern "C" (Rust 2024 compatibility). |
| examples/README.md | Adds the new WASI print example to the index table. |
| examples/http/wasi/variables_and_secrets/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/simple_fetch/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/secret_rollover/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/print/src/lib.rs | New WASI example that outputs method/URL/headers into the response body. |
| examples/http/wasi/print/README.md | New README for the WASI print example. |
| examples/http/wasi/print/Cargo.toml | New manifest for the WASI print example. |
| examples/http/wasi/outbound_fetch/src/lib.rs | Switches to env-configured origin and returns upstream response directly. |
| examples/http/wasi/outbound_fetch/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/large_env_variable/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/key_value/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/hello_world/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/headers/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/geo_redirect/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/cache/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/wasi/cache/Cargo.lock | Updates pinned fastedge versions used by this example. |
| examples/http/basic/watermark/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/smart_switch/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/secret/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/s3upload/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/print/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/outbound_fetch/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/markdown_render/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/hello_world/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/cache/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/backend/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/http/basic/api_wrapper/Cargo.toml | Renames package + updates edition for workspace inclusion. |
| examples/cdn/variables_and_secrets/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/request_url/src/lib.rs | New CDN example that rewrites request properties based on special headers. |
| examples/cdn/request_url/README.md | New README documenting request property rewriting behavior. |
| examples/cdn/request_url/Cargo.toml | New manifest for the request_url CDN example. |
| examples/cdn/properties/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/md2html/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/log_time/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/large_env_variable/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/key_value/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/jwt/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/http_call/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/hello_world/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/headers/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/geoblock/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/geo_redirect/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/custom/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/custom_error_pages/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/cors/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/convert_image/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/cache_control/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/body/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/api_key/Cargo.toml | Renames package for workspace inclusion. |
| examples/cdn/ab_testing/Cargo.toml | Renames package for workspace inclusion. |
| derive/src/lib.rs | Updates no_mangle usage for Rust 2024 (#[unsafe(no_mangle)]). |
| derive/Cargo.toml | Updates derive crate edition to 2024. |
| Cargo.toml | Expands workspace members to include all examples; sets workspace edition/version; narrows default-members. |
| Cargo.lock | Updates lockfile to include workspace-wide deps (including examples). |
| .github/workflows/ci.yaml | Builds/docs/clippy only SDK packages (not all workspace members). |
| .github/workflows/build-examples.yaml | Builds examples via --manifest-path (no per-dir subshell). |
Comment on lines
+5
to
+50
| # CDN examples | ||
| "examples/cdn/ab_testing", | ||
| "examples/cdn/api_key", | ||
| "examples/cdn/body", | ||
| "examples/cdn/cache_control", | ||
| "examples/cdn/convert_image", | ||
| "examples/cdn/cors", | ||
| "examples/cdn/custom", | ||
| "examples/cdn/custom_error_pages", | ||
| "examples/cdn/geo_redirect", | ||
| "examples/cdn/geoblock", | ||
| "examples/cdn/headers", | ||
| "examples/cdn/hello_world", | ||
| "examples/cdn/http_call", | ||
| "examples/cdn/jwt", | ||
| "examples/cdn/key_value", | ||
| "examples/cdn/large_env_variable", | ||
| "examples/cdn/log_time", | ||
| "examples/cdn/md2html", | ||
| "examples/cdn/properties", | ||
| "examples/cdn/request_url", | ||
| "examples/cdn/variables_and_secrets", | ||
| # HTTP basic (sync) examples | ||
| "examples/http/basic/api_wrapper", | ||
| "examples/http/basic/backend", | ||
| "examples/http/basic/cache", | ||
| "examples/http/basic/hello_world", | ||
| "examples/http/basic/markdown_render", | ||
| "examples/http/basic/outbound_fetch", | ||
| "examples/http/basic/print", | ||
| "examples/http/basic/s3upload", | ||
| "examples/http/basic/secret", | ||
| "examples/http/basic/smart_switch", | ||
| "examples/http/basic/watermark", | ||
| # HTTP WASI (async) examples | ||
| "examples/http/wasi/cache", | ||
| "examples/http/wasi/geo_redirect", | ||
| "examples/http/wasi/headers", | ||
| "examples/http/wasi/hello_world", | ||
| "examples/http/wasi/key_value", | ||
| "examples/http/wasi/large_env_variable", | ||
| "examples/http/wasi/outbound_fetch", | ||
| "examples/http/wasi/print", | ||
| "examples/http/wasi/secret_rollover", | ||
| "examples/http/wasi/simple_fetch", | ||
| "examples/http/wasi/variables_and_secrets", |
Comment on lines
25
to
27
| | [hello_world](./http/wasi/hello_world/) | Simplest async request handler — returns a greeting with the request URL | | ||
| | [print](./http/wasi/print/) | Print request method, URL, and headers to the response body | | ||
| | [headers](./http/wasi/headers/) | Echo request headers and add a custom header from an environment variable | |
| [dependencies] | ||
| log = "0.4" | ||
| proxy-wasm = "0.2" | ||
| querystring = "1.1" |
Comment on lines
2
to
6
| [package] | ||
| name = "api_wrapper" | ||
| name = "http_api_wrapper" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "backend" | ||
| name = "http_backend" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "api_key" | ||
| name = "cdn_api_key" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "jwt" | ||
| name = "cdn_jwt" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "key_value" | ||
| name = "cdn_key_value" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "large_env_variable" | ||
| name = "cdn_large_env_variable" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
Comment on lines
2
to
6
| [package] | ||
| name = "variables_and_secrets" | ||
| name = "cdn_variables_and_secrets" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
|
|
qrdl
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.