mojolicious

Mojolicious over HTTPS

纵然是瞬间 提交于 2019-12-04 11:37:41
问题 I am using Mojolicious for a web app that requires an encrypted connection, but I don't know how to add SSL support to Mojolicious. My coworker sent me these: files domain.key, domain-bundle.crt, domain.crt and my Mojolicious startup looks like this: sub startup { my $self = shift; $self->secrets(['secretphrase']); $self->config(hypnotoad => {listen => ['http://*:80']}); How can I add HTTPS support without having to use a reverse-proxy 回答1: Found how to do it: sub startup { my $self = shift;

How do I fake the client IP address in a unit test for a Mojolicious app?

让人想犯罪 __ 提交于 2019-12-04 00:30:32
In my Mojolicious app I need to use the client's IP address ( $c->tx->remote_address ) for rate limiting of a service. This works well. I am now trying to build a unit test for this feature, but I am having trouble faking the client's IP in my tests. First I thought that local_address in Mojo::UserAgent might do what I want, but that's where the user agent binds the application locally, and changing it breaks everything because it cannot find the app any more. I then tried using Sub::Override to replace the remote_address in Mojo::Transaction , but that already applies to the client when I do

Mojolicious over HTTPS

痞子三分冷 提交于 2019-12-03 07:21:35
I am using Mojolicious for a web app that requires an encrypted connection, but I don't know how to add SSL support to Mojolicious. My coworker sent me these: files domain.key, domain-bundle.crt, domain.crt and my Mojolicious startup looks like this: sub startup { my $self = shift; $self->secrets(['secretphrase']); $self->config(hypnotoad => {listen => ['http://*:80']}); How can I add HTTPS support without having to use a reverse-proxy user2348668 Found how to do it: sub startup { my $self = shift; $self->secrets(['secretphrase']); $self->config(hypnotoad => { listen => ['https://*:443?cert=

How Upload file using Mojolicious?

陌路散爱 提交于 2019-12-03 05:53:34
I have been trying out Mojolicious web framework based on perl. And I have try to develop a full application instead of the Lite. The problem I am facing is that I am trying to upload files to server, but the below code is not working. Please guide me what is wrong with it. Also, if the file gets uploaded then is it in public folder of the application or some place else. Thanks in advance. sub posted { my $self = shift; my $logger = $self->app->log; my $filetype = $self->req->param('filetype'); my $fileuploaded = $self->req->upload('upload'); $logger->debug("filetype: $filetype"); $logger-

Configure URLs with prefix in Mojolicious behind Reverse Proxy (ProxyPass)

本小妞迷上赌 提交于 2019-11-30 21:37:15
I'm looking for a reliable way to configure Mojolicious running behind an Apache reverse proxy under /app, so that url_for('/foo') actually returns /app/foo instead of just /foo (otherwise all the links would be broken). The documentation shows a reverse proxy example for everything under /. But that's not what I need, since the application should be under /app. Turning ProxyPass / http://localhost:8080/ into ProxyPass /app http://localhost:8080/ will cause the issue as the /app prefix would be missing from all urls generated by the application. The documentation also has a section on

How can you invoke interactive Perl debugging with hypnotoad or morbo?

我怕爱的太早我们不能终老 提交于 2019-11-30 19:16:14
I'm new to mojolicious but have been using Perl for some time. I have to jump through some hoops but I can get the interactive Perl debugger (and Komodo) working with remote connections for Apache but I can't find anything about interactive debugging with hypnotoad or morbo. The command line examples in the basic tutorial on http://mojolicio.us/perldoc/Mojolicious/Guides/Tutorial#Hello-World work fine because you can launch them with perl -d, but I don't see anyway to tell the hypnotoadctl script to put the service in interactive debug mode ala apache. Is this not possible? Hints? Tips?

Configure URLs with prefix in Mojolicious behind Reverse Proxy (ProxyPass)

情到浓时终转凉″ 提交于 2019-11-30 17:18:43
问题 I'm looking for a reliable way to configure Mojolicious running behind an Apache reverse proxy under /app, so that url_for('/foo') actually returns /app/foo instead of just /foo (otherwise all the links would be broken). The documentation shows a reverse proxy example for everything under /. But that's not what I need, since the application should be under /app. Turning ProxyPass / http://localhost:8080/ into ProxyPass /app http://localhost:8080/ will cause the issue as the /app prefix would

How can you invoke interactive Perl debugging with hypnotoad or morbo?

不想你离开。 提交于 2019-11-30 03:47:13
问题 I'm new to mojolicious but have been using Perl for some time. I have to jump through some hoops but I can get the interactive Perl debugger (and Komodo) working with remote connections for Apache but I can't find anything about interactive debugging with hypnotoad or morbo. The command line examples in the basic tutorial on http://mojolicio.us/perldoc/Mojolicious/Guides/Tutorial#Hello-World work fine because you can launch them with perl -d, but I don't see anyway to tell the hypnotoadctl

Apache proxyPassReverse and Websockets

怎甘沉沦 提交于 2019-11-30 00:46:18
问题 I've been working on a Perl Mojolicious project that uses websockets. I'm wanting to launch it on a shared server running apache and use proxyPass and proxyPassReverse to make the url prettier for my Mojolicious code running with Hypnotoad. I have it set up as follows. Apache url: mydomain.com Hypnotoad url: mydomain.com:8080 With the following apache entry I can reverse proxy the Hypnotoad server to project.mydomain.com apache.conf entry <VirtualHost *:80> ServerName project.mydomain.com

Passing arguments to redirect_to in mojolicious and using them in the target controller

ε祈祈猫儿з 提交于 2019-11-29 10:39:58
I am passing arguments to redirect_to like $c->redirect_to('named', foo => 'bar'); or $c->redirect_to('named, query => {foo=> 'bar'}); but I am not sure how to use it or retrieve the value of foo in the target controller. $self->redirect_to('named', foo => 'bar') , used without a preceding slash, refers to named routes, and parameters are placed into route placeholders. Each route you define in your application gets assigned a route name by default, or you can assign them manually. (You can also get a list of assigned routes using ./myapp routes ) In a lite app: action # route name get '/named