Skip to content

Commit 4ab581e

Browse files
Add docu for TP loader
1 parent 4048e70 commit 4ab581e

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

docs-java/features/connectivity/008-transparent-proxy.mdx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,56 @@ try {
204204

205205
- `X-Error-Origin` - the source of the error
206206
- `X-Proxy-Server` - the proxy server (Transparent Proxy)
207-
- `X-Error-Message` - thorough error message
207+
- `X-Error-Message` - through error message
208208
- `X-Error-Internal-Code` - set only when the source of the error is the XSUAA or Destination service.
209209
The value is the HTTP code returned from one of these services.
210210
- `X-Request-Id` is sent with the response in all requests, both successful and failed
211211

212212
For more information, see [Troubleshooting](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/transparent-proxy-troubleshooting)
213213

214+
## Transparent Proxy Loader
215+
216+
The `TransparentProxy` class is a `DestinationLoader` that enables routing all destination traffic through a single registered gateway host.
217+
This provides a centralized approach to proxy configuration where all destination requests are automatically routed through the configured gateway.
218+
219+
### Registration Methods
220+
221+
#### Register with Default Port
222+
223+
Register a transparent proxy gateway using the default port 80:
224+
225+
```java
226+
// Register with default port 80
227+
// Note: 'gateway.svc.cluster.local' is a sample for a typical Kubernetes Cluster IP service DNS name pointing to the Transparent Proxy [Destination Gateway](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations)
228+
TransparentProxy.register("gateway.svc.cluster.local");
229+
```
230+
231+
232+
The host will be verified if it is reachable and must not contain any path components.
233+
If no scheme is provided, HTTP will be used by default.
234+
235+
#### Register with Custom Port
236+
237+
Register a transparent proxy gateway with a specified port:
238+
239+
```java
240+
// Register with custom port when Destination Gateway is exposed on a different port via .service.port field in the Destination Custom Resource
241+
TransparentProxy.register("http://gateway.svc.cluster.local", <port>);
242+
```
243+
244+
The final URI will be constructed as: `<normalized-host>:<port>`
245+
246+
### Usage Example
247+
248+
```java
249+
// Register the transparent proxy during application initialization
250+
TransparentProxy.register("gateway.svc.cluster.local", 8080);
251+
252+
// All subsequent destination requests will be routed through the registered gateway
253+
// Note: return type is of type TransparentProxyDestination which implements Destination
254+
Destination destination = DestinationAccessor.getDestination("my-destination");
255+
```
256+
214257
## Related Documentation
215258

216259
- [HTTP Client](http-client) - For using destinations with HTTP clients

docs-java/features/connectivity/TransparentProxy

Whitespace-only changes.

0 commit comments

Comments
 (0)