# Policy Development Kit (PDK)   [![Latest Version]][crates.io] [![pdk msrv]][Rust 1.87]
[Latest Version]: https://img.shields.io/badge/crates.io-v1.6.0-blue
[crates.io]: https://crates.io/crates/pdk
[pdk msrv]: https://img.shields.io/badge/pdk_msrv-1.87-lightgray
[Rust 1.87]: https://blog.rust-lang.org/2025/05/15/Rust-1.87.0
**pdk is the primary crate for building Flex Gateway custom policies.**
---
You may be looking for:
- [An overview of PDK](https://docs.mulesoft.com/pdk/latest/policies-pdk-overview)
- [Examples](https://github.com/mulesoft/pdk-custom-policy-examples)
- [Release notes](https://docs.mulesoft.com/release-notes/pdk/pdk-release-notes)
## pdk in action
```toml
[dependencies]
pdk = { version = "1.6" }
```
```rust
use anyhow::{anyhow, Result};
use pdk::hl::*;
use crate::generated::config::Config;
// handle the headers on the incoming http request.
async fn request_filter(request_state: RequestState, _config: &Config) {
let headers_state = request_state.into_headers_state().await;
// Replace the current value of the header 'example-replaced-header' with the value 'example-replaced-value'
headers_state.handler().set_header("example-replaced-header", "example-replaced-value");
}
#[entrypoint]
async fn configure(launcher: Launcher, Configuration(bytes): Configuration) -> Result<()> {
let config: Config = serde_json::from_slice(&bytes).map_err(|err| {
anyhow!(
"Failed to parse configuration '{}'. Cause: {}",
String::from_utf8_lossy(&bytes),
err
)
})?;
let filter = on_request(|rs| request_filter(rs, &config));
launcher.launch(filter).await?;
Ok(())
}
```
#### License
<sup>
Licensed under <a href="../LICENSE.txt">Salesforce Inc License</a>.
</sup>