Reverse proxy support in Quarkus

1,918 views
Skip to first unread message

Vishal Goel

unread,
Jun 10, 2020, 2:41:30 PM6/10/20
to Quarkus Development mailing list
I have Embedded Jetty running which has reverse proxy servlet mapped for a particular URL. For ex: http://url1/abc is reverse proxied to http://url2. This works great, whenever someone calls http://url1/abc, data is served from http://url2 behind the scene (without rewriting the url).

I want to achieve the same using quarkus. Is this possible to implement reverse proxy in Quarkus? I think one of the option is to write own code in ContainerRequestFilter but I am looking more for OOTB support just like jetty. Can somehow undertow be leveraged here?

Please help.

William Burke

unread,
Jun 10, 2020, 3:40:23 PM6/10/20
to vishalg...@gmail.com, Quarkus Development mailing list
I think we only have support for defining the root path:  quarkus.http.root-path

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/f8f7b77d-fcdc-4b30-ab8c-faf5a4d7af44o%40googlegroups.com.


--
Bill Burke
Red Hat

Stuart Douglas

unread,
Jun 10, 2020, 7:29:31 PM6/10/20
to Burke, Bill, vishalg...@gmail.com, Quarkus Development mailing list
On Thu, 11 Jun 2020 at 05:40, William Burke <bbu...@redhat.com> wrote:
I think we only have support for defining the root path:  quarkus.http.root-path

This is all we have at the moment, but it means that you don't need to do any rewriting at all, everything is served from the actual URL, so it should perform much better than URL rewriting solutions.

Stuart
 

Vishal Goel

unread,
Jun 10, 2020, 10:41:56 PM6/10/20
to Quarkus Development mailing list
I understand the root path property but this would only solve the first part of the problem. In our case, http://url2 is some other server running out of our control. This means I need to redirect/reverse proxy the calls there from quarkus app which is what I was asking for.

Paul Carter-Brown

unread,
Jun 11, 2020, 3:22:43 AM6/11/20
to vishalg...@gmail.com, Quarkus Development mailing list
We have written a reverse proxy on quarkus as part of an api gateway solution. It's a combination of a servlet filter and async http client doing back to back http. The servlet filter is non blocking async and streams to request into the http client which has netty under the covers and again is non blocking async. When responses from the target server come back they are proxied back to the original caller.

This is more about non blocking servlet filters and http clients than Quarkus itself. Quarkus role in this is via undertow as the servlet container.

On Thu, 11 Jun 2020, 04:41 Vishal Goel, <vishalg...@gmail.com> wrote:
I understand the root path property but this would only solve the first part of the problem. In our case, http://url2 is some other server running out of our control. This means I need to redirect/reverse proxy the calls there from quarkus app which is what I was asking for.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Vishal Goel

unread,
Jun 11, 2020, 3:34:46 AM6/11/20
to Quarkus Development mailing list
Hi,

I tried to do it through undertow-handlers.conf (placing it in META-INF folder). It worked well for redirect and rewrite but throwing error for reverse-proxy:
path-prefix('/a') -> redirect('/b)
path-prefix('/a1') -> rewrite('/b1')
path-prefix('/a2') -> reverse-proxy('http://localhost:7100/b')

If I have first two only, quarkus is started successfully and requests are served correctly. If I started using third one, quarkus start gets failed with below error.

Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: UT000045: Error parsing predicated handler string no handler named reverse-proxy known handlers are [disallowed-methods, allowed-methods, jdbc-access-log, secure-cookie, access-log, mark-secure, response-rate-limit, canonical-path, response-code, disable-cache, ssl-headers, trace, blocking, url-decoding, access-control, redirect, set, ip-access-control, request-limit, resource, restart, clear, byte-range, done, rewrite, forwarded, stuck-thread-detector, jvm-route, learning-push, dump-request, proxy-peer-address, resolve-local-name, header, store-response, path-separator, resolve-peer-name]:


Although, I see undertow has reverse-proxy handler, not sure why it is not working for me.

Vishal Goel

unread,
Jun 11, 2020, 3:51:22 AM6/11/20
to Quarkus Development mailing list
Can it be due to some dependency missing? I have following in my pom.xml:

 <dependency>
    <groupId>io.quarkus</groupId>
          <artifactId>quarkus-undertow</artifactId>
  </dependency>

William Burke

unread,
Jun 11, 2020, 8:16:18 AM6/11/20
to vishalg...@gmail.com, Quarkus Development mailing list
Why don't you just use a real reverse proxy?  They are simple to set up and run.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Vishal Goel

unread,
Jun 11, 2020, 8:45:11 AM6/11/20
to Quarkus Development mailing list
One of the reason is to have OIDC authentication which quarkus provides quite well OOTB. Most of the reverse proxies (including windows support and open source) do not come with this feature.
To unsubscribe from this group and stop receiving emails from it, send an email to quark...@googlegroups.com.

Vishal Goel

unread,
Jun 11, 2020, 8:46:50 AM6/11/20
to Quarkus Development mailing list
I think the main issue is of dependency here. I see io\undertow\server\handlers package in my app libs but not io\undertow\server\handlers\proxy where I think the reverse proxy code is present.

Vishal Goel

unread,
Jun 12, 2020, 12:26:23 AM6/12/20
to Quarkus Development mailing list
Any update here please esp. on the missing package? Anyway I can add it in pom?

Emanuel Alves

unread,
Jun 13, 2020, 11:33:45 AM6/13/20
to Quarkus Development mailing list
Hi Vishal, 

AFAIK, it's not just a dependency issue. The handler you require, reverse-proxy, was not implemented yet in the quarkus-http project.

Jason Greene

unread,
Jun 14, 2020, 10:31:44 AM6/14/20
to emanuel....@gmail.com, Quarkus Development mailing list
Right it wasn’t a major goal because our primary target use case is microservices on kube, where a lot of these infrastructure scenarios via other means.

While Quarkus HTTP was derived from Undertow, a design goal was to base it on top of Vert.x so that we would have a common layer that supported blending Vert.x and MicroProfile based endpoints and frameworks. Due to this a reverse proxy impl would need to be reimplemented since the Undertow 2.x one is based on xnio. 

If anyone is interested in building this it might be useful to take a look at:


-Jason
On Jun 13, 2020, at 10:33 AM, Emanuel Alves <emanuel....@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/93305321-7cb0-49b6-bc01-1151a1acd4afo%40googlegroups.com.

Emanuel Alves

unread,
Jun 14, 2020, 3:13:49 PM6/14/20
to Quarkus Development mailing list
I can try to do it (just for fun). However, I will take some time to accomplish something. 


On Sunday, 14 June 2020 15:31:44 UTC+1, Jason Greene wrote:
Right it wasn’t a major goal because our primary target use case is microservices on kube, where a lot of these infrastructure scenarios via other means.

While Quarkus HTTP was derived from Undertow, a design goal was to base it on top of Vert.x so that we would have a common layer that supported blending Vert.x and MicroProfile based endpoints and frameworks. Due to this a reverse proxy impl would need to be reimplemented since the Undertow 2.x one is based on xnio. 

If anyone is interested in building this it might be useful to take a look at:


-Jason

Jason Greene

unread,
Jun 14, 2020, 4:12:04 PM6/14/20
to emanuel....@gmail.com, Quarkus Development mailing list

Cool! Let us know if you have any questions.

On Jun 14, 2020, at 2:13 PM, Emanuel Alves <emanuel....@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/757e0ec0-179c-484a-80f9-a27ee8175a43o%40googlegroups.com.

Vishal Goel

unread,
Jun 15, 2020, 12:49:23 AM6/15/20
to Quarkus Development mailing list
Thanks Emanuel. Please let us know once your are done with it.

Vishal Goel

unread,
Sep 21, 2020, 1:13:42 AM9/21/20
to Quarkus Development mailing list
Hi,
Anyone knows if there is any progress here? Can it be available in near future Quarkus releases?

Reply all
Reply to author
Forward
0 new messages