Programming Posts

How to Handle CORS in Red Hat Process Automation Manager

One feature on Red Hat Process Automation Manager (RHPAM) is the ability to provide an API endpoint which can be accessed from multiple applications. But when we call them directly from javascript within a browser, sometimes it would shows a CORS error.

Workaround is quite easy, either we add a CORS header on RHPAM API response or change call method from a browser call into server-to-server call. For this article i would go with the first approach, and that is adding a CORS header on API that RHPAM provides.

Luckily our RHPAM deployment is on top of Openshift, and by adding below key-value parameters to RHPAM kie-server’s Deployment Config is good enough to solve CORS issue.

         - name: FILTERS
           value: "Access-Control-Allow-Origin"
           value: "*"
           value: "Access-Control-Allow-Methods"
           value: "POST,GET,OPTIONS,PUT"
           value: "Access-Control-Allow-Headers"
           value: "*"
           value: "Access-Control-Allow-Credentials"
           value: "true"
           value: "Access-Control-Max-Age"
           value: "86400"

How to Fix Error “Variable content was trimmed as it was too long” on RHPAM

Just yesterday i got a very unique error,

Variable content was trimmed as it was too long (more than 255 characters)

I can see that this error happens due to RHPAM saves the content of each object on database, but have a 255 character as limitation. And for this case, my object content length is more than 255 characters.

Workaround for this is we need to alter database generated by RHPAM and for example below, im changing it from 255 into 5000 characters.

alter table VariableInstanceLog modify column value varchar(5000);

alter table VariableInstanceLog modify column oldValue varchar(5000);

And need to put below parameter runtime,


For a RHPAM deployment on Openshift, we can embed below parameters on RHPAM DeploymentConfig,

	  value: '-Dorg.jbpm.var.log.length=5000'

Restart RHPAM, and we can see now RHPAM can handle object with length up to 5000 characters.


How to Remove Docker’s Dangling Image on Windows 10

There are times where i need to clean all unused, dangling docker images on my laptop. Previously im running below command,

docker image prune -a

But it seems like altho almost all images are gone, i can see still some images are still occupying my laptop’s disk. So i have to do something to delete them.

The workaround is quite easy, run PowerShell as Administrator and run below command,

docker rmi $(docker images --quiet --filter "dangling=true") -f

Executing that command will generates this log,

And i can see that my harddisk is now have more free spaces :-)


Integrating Spring Boot Login with Keycloak or Red Hat Single Sign On

When we are managing many applications, one of the most painful part is managing its user and access right. Because usually different applications have their own user management, and sometimes each user have different credentials between multiple applications.

We can solve this problem by having a one point user management where other application can use this tools for managing their user authentication and authorization. This is where Red Hat Single Sign On (or its opensource product, Keycloak) can comes in handy. It provides an end to end user management lifecyle, from activating a new user, managing them, assigning their access right until deactivating them. On this example, we’ll start with a simple login page by using Keycloak, and how other application (in this example is a Spring Boot app) is connecting to it.

First we need to create a java project with below pom file, im using keycloak-adapter bom and keycloak-spring-boot-starter library for this.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""











And perhaps the most important part in this project is, the In here, we are putting our Keycloak’s url, realm name, client name, and secret. Also we are defining that only user with admin role can access a URL with /admin/ pattern.

### server port
server.port=8080 Boot with RHSSO Login

### rhsso configuration

### spring boot ui configuration

### authorization[0].authRoles[0]=admin[0].securityCollections[0].patterns[0]=/admin/*

Next is we need to create a user and role on Red Hat SSO,

After that, we need to create a client and its password,

And put those corresponding values inside

We can test whether configuration works well or not by directly accessing to admin page (/admin/index). A successful configuration would prevent an unauthorized user from accessing admin page by showing a Keycloak login page. Admin page only accessible once a user has successfully login thru Keycloak or Red Hat Single Sign On.

Full code can be downloaded on my github page,

Have fun with RHSSO and Keycloak (H)


Fixing “SSL routines:tls_process_ske_dhe:dh key too small” on Containerized RHEL8

I have a very unique error today, so basically my RHEL 8 (Red Hat Enterpise Linux) cannot connect to another system due to SSL issue. The exception is quite clear, and can be seen below.

error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small

It is quite easy to do it in a standalone infrastructure, but this problem happen on a containerized application which make it much more complicated.

After searching for a solution, i come up with this Dockerfile


user root
RUN update-crypto-policies --set LEGACY 

user 185

Build it,

docker build -f Dockerfile -t application-rhel8-modified:7.8.0 .

Deploy it, and i can see that the previous error is no longer exist.