Skip to content

feat: Add a rust plugin to add geo query string to URL#294

Open
mateustd-ciandt wants to merge 10 commits into
GoogleCloudPlatform:mainfrom
mateustd-ciandt:rust-plugin-add-geo-query
Open

feat: Add a rust plugin to add geo query string to URL#294
mateustd-ciandt wants to merge 10 commits into
GoogleCloudPlatform:mainfrom
mateustd-ciandt:rust-plugin-add-geo-query

Conversation

@mateustd-ciandt
Copy link
Copy Markdown
Contributor

Adding a new rust plugin in order to modulate content based on the country value.
This value is added as a query string name value pair in the URL.
The query string value is also available in the normal GCP logs.

C++ version PR: #289

@mateustd-ciandt mateustd-ciandt requested a review from a team as a code owner November 25, 2025 15:58
@snippet-bot
Copy link
Copy Markdown

snippet-bot Bot commented Nov 25, 2025

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@mpwarres
Copy link
Copy Markdown
Collaborator

See comment #289 (comment) , the plugin should access geo information via the get_property() API, in anticipation of attribute support for geo info to be added in Q1.

Copy link
Copy Markdown
Collaborator

@mpwarres mpwarres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mod comment

use proxy_wasm::traits::{Context, HttpContext};
use proxy_wasm::types::{Action, LogLevel};

const CLIENT_REGION_PATH: &[&str] = &["request", "client_region"];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is more idiomatic to adjust this to be:

const CLIENT_REGION_PATH: [&str] = ["request", "client_region"];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mike! I believe in Rust [&str] doesn't compile because unsized types cannot be used in const. So as far as I know, we need either &[&str] (reference to slice) or [&str; 2] (array with explicit size).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants