Questions tagged [psgi]

PSGI (Perl Web Server Gateway Interface) is an interface between web servers and Perl-based web applications and frameworks that allows writing portable applications that can be run as standalone servers or using CGI, FastCGI, mod_perl, etc.

PSGI (Perl Web Server Gateway Interface) is an interface between web servers and Perl-based web applications and frameworks that allows writing portable applications that can be run as standalone servers or using CGI, FastCGI, mod_perl, etc. (from: Wikipedia)

This is an example PSGI application:

my $app = sub {
    return [200, ['Content-Type' => 'text/plain'], ["Hello, World!\n"]];
}

PSGI is inspired by Python's (Web Server Gateway Interface), Ruby's and JSGI for JavaScript.

80 questions
7
votes
2 answers

Who is wrong about the http://0:port?

The Plack suite commonly uses the http://0:port. E.g. the following plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' prints HTTP::Server::PSGI: Accepting connections at http://0:5000/ However, the LWP::UserAgent (or some…
kobame
  • 5,766
  • 3
  • 31
  • 62
6
votes
2 answers

Why is raising plackup (or starman) memory usage?

I have this simple PSGI application (app.psgi). use strict; use warnings; my $app = sub { my $mem = `ps -o rss= -p $$`; $mem =~ s/^\s*|\s*$//gs; return [ 200, [ 'Content-Type' => 'text/text' ], [ $mem ]]; }; I was requested the above…
kobame
  • 5,766
  • 3
  • 31
  • 62
6
votes
2 answers

How to setup Apache-like name-based virtual hosts with Starman

In my previous question I asked about a multi-domain solution, but the question was too complex. Now in short: Is it possible to somehow setup name-based virtual hosts with Starman (or with any other pure perl PSGI server) like with Apache's…
clt60
  • 62,119
  • 17
  • 107
  • 194
6
votes
1 answer

Why Dancer app fails under uWSGI + Apache?

My Dancer app fails under uWSGI (2.0.7) + Apache (2.4.10) combination while it runs freely in other environments ( uWSGI + nginx, Starman + Apache, Dancer own dev-server). I don't find in logs any meaningful information. So I made simple test app…
w.k
  • 8,218
  • 4
  • 32
  • 55
5
votes
1 answer

Is there a Perl PSGI/Plack server available that only speaks PSGI and not also HTTP?

A usual deployment have looked in past and present like the following to me: +------------------+ +---------+ tcp +-------+ tcp | PSGI Application |----o| Starman |---->| nginx |<----(internet) +------------------+ +---------+ …
burnersk
  • 3,320
  • 4
  • 33
  • 56
5
votes
0 answers

How to close PSGI connection without response?

My application wants to pass $env->{'psgix.io'} handle to separate process for further WebSocket processing. Pass via UNIX socket dup()s handle, so I don't really care to return any answer from application to PSGI server. But I see no option to just…
5
votes
1 answer

Dancer unique request ID

Is there any unique request ID in Dancer? Apache has mod_unique_id: http://httpd.apache.org/docs/current/mod/mod_unique_id.html PSGI/Plack has a middleware module:…
Sebastian
  • 2,472
  • 1
  • 18
  • 31
5
votes
1 answer

Best way to run a Plack PSGI Perl application outside of Apache using FastCGI?

I'm currently running Apache/mod_perl with a PSGI-application invoked by Plack::Handler::Apache2. The problem we have is each Apache process consumes a connection to the PostgreSQL database, which is expensive. To solve this, we plan to run the…
5
votes
1 answer

Do I need to convert mod_rewrite rules to Plack::Middleware::Rewrite rules if my web framework wants to support PSGI?

We've got a FastCGI-based web framework that we use internally for some mission critical apps. Thus moving to an existing PSGI-complaint framework is not very practical. We've successfully moved our framework over from plain old CGI.pm to Plack…
GeneQ
  • 7,485
  • 6
  • 37
  • 53
5
votes
2 answers

Handling authentication with Apache reverse proxy for plack/PSGI app

This is my scenario: So, Requests via encrypted HTTPS go to Apache like: https://server1/MyPerlApp If the user is not logged in, they get a redirect to some login page (in the server1), and Apache doesn't proxy the request to Server2 When the…
kobame
  • 5,766
  • 3
  • 31
  • 62
5
votes
1 answer

Server-side Websocket implementations in non-event driven HTTP Server Environments

I am trying to understand implementations/options for server-side Websocket endpoints - particularly in Perl using PSGI/Plack and I have a question: Why are all server-side websocket implementations based around event-driven PSGI servers (Twiggy,…
Gurunandan Bhat
  • 3,544
  • 3
  • 31
  • 43
4
votes
0 answers

Perl's PSGI/Plack and streaming response content

I'm exploring PSGI/Plack and how to do streaming/delayed responses. Already google'd around but find little to no examples of how to do it. Below are little bits and pieces I gathered from the PSGI::FAQ on metacpan. For example, if I want to stream…
santa100
  • 255
  • 1
  • 5
4
votes
1 answer

Set custom environment variable to psgi hash plack

When I do a request to dumper $env I get all data of enviromment hash psgi, in this example sub { my $env = shift; return [ 200, [], [ $env->{REMOTE_ADDR} ] ]; } or more directly sub { return [ 200, [], [ shift->{REMOTE_ADDR} ] ]; …
Imylor
  • 384
  • 1
  • 9
4
votes
1 answer

Mount "hosts" in Plack::Builder

The Synopsis for the Plack::Builder and also this answer says: # in .psgi use Plack::Builder; my $app = sub { ... }; builder { mount "/foo" => builder { enable "Foo"; $app; }; mount "/bar" => $app2; mount…
cajwine
  • 3,100
  • 1
  • 20
  • 41
4
votes
0 answers

Apache/Starman - how to implement lots of different webapps with single virtual host

I have a lot of CGI web applications under apache2, which have complex jQueryUI powered interfaces and corresponding perl backend, based upon CGI::Application framework. For user it looks like…
tercoz
  • 81
  • 6