...
The Gateway Proxy is a standalone application to be deployed separately. The proxy enables communication to an outbound server through it's REST API. If a request is send to it’s endpoint it will forward the request http endpoint at /proxy/stream
. Requests to this endpoint will be forwarded to upstream servers.
The proxy is build on top of Spring Boot. It's connection routing aware and offers authentication via OAuth20, Oauth10A, a Bearer Token forward mechanism and fixed headers.
...
By default the proxy only works for outbound connections to URLs configured in the connection-routing-.yml
file. All other requests are blocked. Setting the environment variable PROXY_ALLOW_UNKNOWN_TARGETs
to true
allows requests to be proxied to all target URLs.
...
Logging verbosity can be controlled by an environment variable called PROXY_GATEWAY_LOG_LEVEL
. Set this to DEBUG
for full verbosity and to INFO
for more concise logging output.
Running the
...
After building the Gateway Proxy it can be started using the jar file built in the previous step:
Code Block |
---|
#> java -jar target/smartfacts-gateway-proxy-<version>.jar |
Running the Docker Container
Application
The application is also provided as a docker container at registry.mid.de/smartfacts/smartfacts-gateway-proxy:latest
and . A docker-compose.yml
file can be started using the docker-compose.yml
file in the root directory of this project. The docker compose file is configured to run the application on port 8418 on the host machine. In order to supply a custom used to run the gateway proxy in a Docker environment and provide volumes to inject SSL certificates and a connection-routing.yml
file. The following example docker-compose.yml
file exposes the proxy on port 8418
of the docker host. It uses the certificates stored in /tmp/certificates
. It uses the connection-routing.yml
file at /tmp/connection-routing.yml
configuration file they can be mounted s volumes in the root directory of the docker image.
...
Docker Compose configuration file
Code Block | ||
---|---|---|
| ||
services:
gateway-proxy:
image: registry.mid.de/smartfacts/smartfacts-gateway-proxy:<VERSION>
ports:
- 8418:8080
environment:
- USE_SYSTEM_CA_CERTS=1
volumes:
- /tmp/cacerts:/certificates
- /tmp/connection-routing.yml:/opt/smartfacts-gateway-proxy/connection-routing.yml |
Starting the docker container
Change to the directory containing the docker-compose.yml
configuration file. In order to access the MID Docker registry you need an access token from MID.
Code Block | ||
---|---|---|
| ||
#> docker login registry.mid.de
#> docker compose up gateway-proxy |
Proxy HTTP Endpoint
The proxy application exposes the endpoint /proxy/stream
to relay HTTP GET, POST, PUT, DELETE, PATCH and HEAD requests. Only requests to outbound servers that are configured in the connection-routing.yml
configuration file are allowed by default. This behavior can be controlled by the environment variable PROXY_ALLOW_UNKNOWN_TARGETS
.
...