This page provides code samples that address some common use cases for plugins.
Add HTTP request and response headers
The following code samples show how to add HTTP request and response headers.
C++
Rust
Rewrite the request URL
The following code samples show how to rewrite the request URL by using regular expressions. The following code samples remove part of the path, but any URI mutation, such as path, query, or fragment, is feasible.
These samples also show best practices around regular expressions, namely using linear-time regular expression libraries and compiling the expressions at plugin initialization time.
C++
Rust
Enable logging for custom variables
The following code samples show how to perform a basic check on the request query string parameters and emit parsed information to Cloud Logging. These samples also show how to parse URLs.