---
title: "Per-Proxy Request Contexts"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts
language: ruby
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Per-Proxy Request Contexts

Programming language: Ruby. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/python.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/per-proxy-request-contexts/swift.md).

Each proxy stores a request context, empty by default. Ice sends this per-proxy context with each invocation made through the proxy, unless the invocation has an [explicit context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/explicit-request-contexts/ruby.md).

`ice_context` returns a new proxy that stores the given context, and `ice_getContext` returns the proxy's context:

```ruby
greeterEs = greeter.ice_context({"language"=>"es"})
```

The per-proxy context is a local setting of the proxy: a stringified proxy cannot carry one, and Ice does not marshal it when it sends the proxy to another application.

## Configuring a Per-Proxy Request Context with Properties

When you create a proxy with `propertyToProxy`, the `Context` properties of the proxy property set its per-proxy context:

```config
Greeter.Proxy=greeter:tcp -h localhost -p 4061
Greeter.Proxy.Context.language=es
```

Each `name.Context.key=value` property adds the entry `key` with the value `value`. To change this context, call `ice_context` with an updated copy of the dictionary that `ice_getContext` returns.

## See Also

- [Proxy Properties](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/ruby.md)
