Is it possible to make Mojolicious::Plugin::DefaultHelpers::redirect_to method act same as nginx proxy_pass module?

43 views
Skip to first unread message

Pavel Serikov

unread,
Feb 7, 2022, 10:27:06 AM2/7/22
to Mojolicious
I need to redirect requests to particular IP address depending on requested url.

E.g.
etc.

Is it possible with Mojolicious out-of-the-box?

Stefan Adams

unread,
Feb 12, 2022, 12:02:55 PM2/12/22
to mojolicious
Like this?

get '/:x' => sub ($c) {
  $c->redirect_to('http://172.22.0.6:80/') if $c->param('x') eq 'foo';
  $c->redirect_to('http://172.22.0.7:80/') if $c->param('x') eq 'bar';
};

--
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/1d5193e0-c1a0-4989-bdc4-282245d7626an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages