Securing API with issues on a deployed instance

Hi everyone,
I´m using a keycloak instance to login in the frontend and secure the backend-api. After deployment on a linux machine on aws I faced a issue. I´m getting constantly redirected to the login page by accessing the api with a jwt token. Locally it´s working fine.

My client is a confidential client. I´m using client_id and _secret to authorize for the token call. The jwt token is valid and sucessfully generated.
My implementation of the api works with expressJs and the keycloak-nodejs-connector:

    keycloakConfig = {
        serverUrl: '',
        realm: 'examplerealm',
        clientId: 'ui-client'

   public init() {
        if (this.keycloak) {
            console.warn("Trying to init Keycloak again!");
            return this.keycloak;
        else {
            console.log("Initializing Keycloak...");
            const memoryStore = new session.MemoryStore();
            // @ts-ignore
            this.keycloak = new Keycloak({ store: memoryStore }, this.keycloakConfig );
            return this.keycloak;

I could imagine that it is dependent on the current https setting. My nodejs api provides a endpoint for http and https (locally with a self signed certificate). On the server, where keycloak is running, I added a letsencrypt certificate with certbot and everything looks fine in the browser.
Keycloak is started with the docker-container jboss/keycloak.

I´m curious to figure out my current issue and help is very appreciated :slight_smile: Let me know, if I missed to add necessary informations.
Thanks in advance.

I followed this medium article