Skip to content

How to configure API Gateway #52

@landorg

Description

@landorg

Hi.
I am struggling to configure our kong api gateway to work with the graphdb cluster setup.
AFAICS it should forward things like that:
(if graphdb.workbench.subpath is /graphdb)

example.com/graphdb(.*)  ->  <internal-ip:port><\1 (capture group one)>
example.com/graphdb/index.html  ->  <internal-ip:port>/index.html

am I getting this right?
I disabled the default ingress and created one manually to be able to set the proper kong regex prefix:

{
          path: "/~/graphdb(.*)"
...
}

and then replace it with:

{
    uri: "$(uri_captures[1])"
...
}

imo this should be working but I get a 500 and:


[ERROR] 2023-02-07 18:12:03,714 [http-nio-7200-exec-1 \| c.o.g.p.ClusterProxyServlet] Request to http://index.html failed.
--
Tue, Feb 7 2023 7:12:03 pm | java.net.UnknownHostException: index.html: Name does not resolve
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1529)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1519)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1378)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
Tue, Feb 7 2023 7:12:03 pm | at com.ontotext.graphdb.http.ServletProxy.proxyRequestWithAuthentication(ServletProxy.java:132)
Tue, Feb 7 2023 7:12:03 pm | at com.ontotext.graphdb.proxy.ClusterProxyBean.handleRequest(ClusterProxyBean.java:99)
Tue, Feb 7 2023 7:12:03 pm | at com.ontotext.graphdb.proxy.ClusterProxyServlet.handleRequest(ClusterProxyServlet.java:47)
Tue, Feb 7 2023 7:12:03 pm | at com.ontotext.graphdb.proxy.ClusterProxyServlet.service(ClusterProxyServlet.java:43)
Tue, Feb 7 2023 7:12:03 pm | at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
Tue, Feb 7 2023 7:12:03 pm | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
Tue, Feb 7 2023 7:12:03 pm | at java.base/java.lang.Thread.run(Thread.java:829)

Am I getting this wrong?
Any idea what could be causing this?
Thanks

EDIT
x-forwarded-* headers should in theory be set by kong: https://docs.konghq.com/gateway/latest/how-kong-works/routing-traffic/#proxying-and-upstream-timeouts
I'll confirm this. Which of these are required by your proxy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions