Reverse Proxy

34 views
Skip to first unread message

Stefan Adams

unread,
Sep 10, 2019, 2:17:06 AM9/10/19
to mojolicious
From the Cookbook#Reverse Proxy:

[A reverse proxy] can provide a lot of benefits, like terminating SSL connections from the outside, limiting the number of concurrent open sockets towards the Mojolicious application (or even using Unix sockets), balancing load across multiple instances, or supporting several applications through the same IP/port.

What steps are necessary to support several applications through the same IP/port?

I'm picturing having two separate Mojolicious applications running in two separate system processes, each with their own Perl binary even.  What is necessary to reverse proxy a connection to these two separate apps listening on the same IP/port?  How does the reverse proxy (nginx) know which process should get the request proxied to it?

Or am I misunderstanding what is stated in bold above?

Илья Рассадин

unread,
Sep 10, 2019, 2:22:22 AM9/10/19
to mojol...@googlegroups.com

Hi! Reverse proxy (such as Nginx) can proxy different requests to the different apps based on different params.

For example, you have an application doing auth and application doing something only for the authorized users. So domain auth.app.com could be proxied to auth app and domain internal.app.com to the second app.

You can do it based on whatever nginx supports - host, location, some get args or header in request and so on.

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFSkT_YXpnUbakT%3DO%2Bi1y99vVxpg8rVo%3D8V33LUtLhNfPQ%40mail.gmail.com.

Dan Book

unread,
Sep 10, 2019, 2:23:57 AM9/10/19
to mojol...@googlegroups.com
Most commonly, different nginx servers (the nginx equivalent of Apache virtualhosts) will listen on different hostnames, and then proxy to different backend applications.

-Dan

--

Stefan Adams

unread,
Sep 10, 2019, 2:47:48 AM9/10/19
to mojolicious
Thank you both!  I see -- I did misread that bold.  I interpreted it as several applications through the same internal IP/port.  I understand now that it was referring to the same visible from the outside IP/port.

My question has been answered!

Reply all
Reply to author
Forward
0 new messages