<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>I'm getting a strange error in my production deployment which I'm having difficulty troubleshooting.</div>
<div><br>
</div>
<div>After deploying the apiman UI and gateway on separate hosts, according to the production guide I have to point the API Manager to the API gateway. If I hit the &quot;New Gateway&quot; button, I need to add the URI of the gateway. &nbsp;I'm assuming this should be</div>
<div><br>
</div>
<div>[PROTOCOL]://[GATEWAY_HOST]:[GATEWAY_PORT]/apiman-gateway-api/ -- which should also be set as the redirect URI for the gateway in the Apiman realm in Keycloak (followed by a star). This is different from my public endpoint, which is [PROTOCOL]://[GATEWAY_HOST]:[GATEWAY_PORT]/apiman-gateway</div>
<div><br>
</div>
<div>When I use the apimanager user (set up in the default realm file) to test the gateway in the &quot;New Gateway&quot; screen I'm getting this error:</div>
<div><br>
</div>
<div><strong apiman-i18n-key="gateway-config-invalid.title" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 13px; background-color: rgb(255, 242, 245);">Gateway Configuration Invalid</strong><span style="color: rgb(51, 51, 51); font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 13px; background-color: rgb(255, 242, 245);"></span>
<div apiman-i18n-key="gateway-config-invalid.msg" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 13px; background-color: rgb(255, 242, 245);">
Something has gone wrong when testing the Gateway. Hopefully the details (below) will help you figure out what.</div>
<div style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 13px; background-color: rgb(255, 242, 245); margin-top: 8px;">
<pre class="ng-binding" style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, monospace; font-size: 11px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.66666667; word-break: break-all; word-wrap: break-word; background-color: rgb(252, 252, 252); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px;">org.codehaus.jackson.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: org.apache.http.conn.EofSensorInputStream@450a7e3f; line: 1, column: 2]</pre>
</div>
</div>
<div><br>
</div>
<div>If I look at what's happening in the API manager log, it looks like the error is coming from getting HTML back from Keycloak where it's expecting JSON. Is there some configuration I'm missing? Here are the relevant API manager server logs:</div>
<div><br>
</div>
<div>
<div><br>
</div>
<div><span style="font-family: Courier;">21:38:49,715 DEBUG [org.keycloak.adapters.RequestAuthenticator] (default task-1) Bearer AUTHENTICATED</span></div>
<div><span style="font-family: Courier;">21:38:49,717 DEBUG [org.keycloak.adapters.AuthenticatedActionsHandler] (default task-1) AuthenticatedActionsValve.invoke https://[APIMANUI]/apiman/gateways</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,796 DEBUG [org.apache.http.impl.execchain.MainClientExec] (default task-1) Opening connection {s}-&gt;https://[GATEWAY]</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,864 DEBUG [org.apache.http.impl.execchain.MainClientExec] (default task-1) Executing request GET /apiman-gateway-api/system/status HTTP/1.1</span></div>
<div><span style="font-family: Courier;">21:38:50,864 DEBUG [org.apache.http.impl.execchain.MainClientExec] (default task-1) Proxy auth state: UNCHALLENGED</span></div>
<div><span style="font-family: Courier;">21:38:50,866 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-0 &gt;&gt; GET /apiman-gateway-api/system/status HTTP/1.1</span></div>
<div><span style="font-family: Courier;">21:38:50,866 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-0 &gt;&gt; Authorization: Basic YXBpbWFuYWdlcjphcGltYW4xMjMh</span></div>
<div><span style="font-family: Courier;">21:38:50,866 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-0 &gt;&gt; Host: [GATEWAY]</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,881 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-0 &lt;&lt; &quot;HTTP/1.1 302 Found[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,881 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-0 &lt;&lt; &quot;Expires: 0[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,881 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-0 &lt;&lt; &quot;Set-Cookie: OAuth_Token_Request_State=19/8069a233-7d97-4f9d-8696-673f72815124; secure[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,882 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-0 &lt;&lt; &quot;Location: https://[KEYCLOAK]/auth/realms/apiman/protocol/openid-connect/auth?response_type=code&amp;client_id=apiman-gateway-api&amp;redirect_uri=https%3A%2F%2F[GATEWAY]%2Fapiman-gateway-api%2Fsystem%2Fstatus&amp;state=19%2F8069a233-7d97-4f9d-8696-673f72815124&amp;login=true[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,894 DEBUG [org.apache.http.client.protocol.ResponseProcessCookies] (default task-1) Cookie accepted [OAuth_Token_Request_State=&quot;19/8069a233-7d97-4f9d-8696-673f72815124&quot;, version:0, domain:ec2-52-34-81-26.us-west-2.compute.amazonaws.com,
 path:/apiman-gateway-api/system, expiry:null]</span></div>
<div><span style="font-family: Courier;">21:38:50,894 DEBUG [org.apache.http.impl.client.DefaultRedirectStrategy] (default task-1) Redirect requested to location 'https://[KEYCLOAK]/auth/realms/apiman/protocol/openid-connect/auth?response_type=code&amp;client_id=apiman-gateway-api&amp;redirect_uri=https%3A%2F%2F[GATEWAY]%2Fapiman-gateway-api%2Fsystem%2Fstatus&amp;state=19%2F8069a233-7d97-4f9d-8696-673f72815124&amp;login=true'</span></div>
<div><span style="font-family: Courier;">21:38:50,900 DEBUG [org.apache.http.impl.execchain.RedirectExec] (default task-1) Resetting target auth state</span></div>
<div><span style="font-family: Courier;">21:38:50,900 DEBUG [org.apache.http.impl.execchain.RedirectExec] (default task-1) Redirecting to 'https://[KEYCLOAK]/auth/realms/apiman/protocol/openid-connect/auth?response_type=code&amp;client_id=apiman-gateway-api&amp;redirect_uri=https%3A%2F%2F[GATEWAY]%2Fapiman-gateway-api%2Fsystem%2Fstatus&amp;state=19%2F8069a233-7d97-4f9d-8696-673f72815124&amp;login=true'
 via {s}-&gt;https://[KEYCLOAK]</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,902 DEBUG [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] (default task-1) Connection request: [route: {s}-&gt;https://[KEYCLOAK]][total kept alive: 1; route allocated: 0 of 2; total allocated: 1
 of 20]</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,935 DEBUG [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] (default task-1) Connection established 172.17.1.52:46173&lt;-&gt;172.31.41.242:8443</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.impl.execchain.MainClientExec] (default task-1) Executing request GET /auth/realms/apiman/protocol/openid-connect/auth?response_type=code&amp;client_id=apiman-gateway-api&amp;redirect_uri=https%3A%2F%2F[GATEWAY]%2Fapiman-gateway-api%2Fsystem%2Fstatus&amp;state=19%2F8069a233-7d97-4f9d-8696-673f72815124&amp;login=true
 HTTP/1.1</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.impl.execchain.MainClientExec] (default task-1) Proxy auth state: UNCHALLENGED</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-1 &gt;&gt; GET /auth/realms/apiman/protocol/openid-connect/auth?response_type=code&amp;client_id=apiman-gateway-api&amp;redirect_uri=https%3A%2F%2F[GATEWAY]%2Fapiman-gateway-api%2Fsystem%2Fstatus&amp;state=19%2F8069a233-7d97-4f9d-8696-673f72815124&amp;login=true
 HTTP/1.1</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-1 &gt;&gt; Authorization: Basic YXBpbWFuYWdlcjphcGltYW4xMjMh</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-1 &gt;&gt; Host: [KEYCLOAK]</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-1 &gt;&gt; User-Agent: Apache-HttpClient/4.5 (Java/1.8.0_25)</span></div>
<div><span style="font-family: Courier;">21:38:50,936 DEBUG [org.apache.http.headers] (default task-1) http-outgoing-1 &gt;&gt; Accept-Encoding: gzip,deflate</span></div>
<div><span style="font-family: Courier;">...</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;HTTP/1.1 200 OK[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;X-Powered-By: Undertow/1[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Set-Cookie: KC_RESTART=[COOKIE]; Version=1; Path=/auth/realms/apiman; HttpOnly[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Server: WildFly/9[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;X-Frame-Options: SAMEORIGIN[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Content-Security-Policy: frame-src 'self'[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Date: Mon, 14 Dec 2015 21:38:50 GMT[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Connection: keep-alive[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Content-Type: text/html[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;Content-Length: 4171[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,960 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;[\r][\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &nbsp;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; class=&quot;login-pf&quot;&gt;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;&lt;head&gt;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot; &nbsp; &nbsp;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot;/&gt;[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot; &nbsp; &nbsp;&lt;title&gt; &nbsp; &nbsp; &nbsp; &nbsp;Log in to apiman[\n]&quot;</span></div>
<div><span style="font-family: Courier;">21:38:50,961 DEBUG [org.apache.http.wire] (default task-1) http-outgoing-1 &lt;&lt; &quot;&lt;/title&gt;[\n]&quot;</span></div>
</div>
<div><span style="font-family: Courier;">&#8230; more html&#8230;</span></div>
<div><br>
</div>
<div>
<div><br>
</div>
</div>
</body>
</html>