jboss-tools

Error no session found in request from keycloak-gatekeeper


I am trying to secure kibana through keycloak but after login, keycloak-gatekeeper throws multiple errors and browser show ERR_TO_MANY_REDIRECTS:

info    issuing access token for user   {"email": "xxx@example.com", "expires": "2019-03-23T00:18:30Z", "duration": "1m3.401805266s"}
error   no session found in request, redirecting for authorization      {"error": "authentication session not found"}

My keycloak-gatekeeper configuration file is this:

skip-openid-provider-tls-verify: true
secure-cookie: false
discovery-url: https://keycloak.example.com/auth/realms/REALM
client-id: kibana
client-secret: xxx-xxx...
listen: 0.0.0.0:3000
enable-refresh-tokens: true
redirection-url: http://kibana.example.com/
encryption-key: AgXa7xRcoClDEU0ZDSH4X0XhL5Qy2Z2j
upstream-url: http://kibana:5601

My apache2 vhost configuration file is this:

Define VHOST_KIBANA kibana.example.com
<VirtualHost ${VHOST_KIBANA}:80>
    ServerName ${VHOST_KIBANA}

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyRequests On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://127.0.0.1:8180/
    ProxyPassReverse / http://127.0.0.1:8180/

    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

What could be causing that error?

Thank you


Solution

  • The problem was the apache configuration, this way it worked correctly:

    Define VHOST_KIBANA kibana.example.com
    <VirtualHost ${VHOST_KIBANA}:80>
        ServerName ${VHOST_KIBANA}
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        ProxyPreserveHost On
    
        ProxyPass / http://127.0.0.1:8180/
        ProxyPassReverse / http://127.0.0.1:8180/
    </VirtualHost>