Giter Club home page Giter Club logo

Comments (1)

miyagawa avatar miyagawa commented on June 30, 2024

Thanks for opening the issue!

As you can follow the thread on Starlet, there are two possible suggestions:

Allow psgix env var to indicate that the current request is incomplete/broken

Server will (optionally) mark the broken or invalid request with psgix.invalid_request and such, and send as a regular PSGI env to the application. Application will look at that PSGI environment variable and do whatever it wants to do, such as logging to a special error log, or just throw it away.

Because PSGI specification does not currently have a way for application to server, there needs to be a way for developers to turn on this option, because otherwise PSGI application that are not aware of will be sent such requests and cause unexpected behaviors (as stated in the original issue).

Servers support Error Handlers app

In addition to the regular (main) PSGI application, servers will accept a separate PSGI application handler to handle such errors. This is close to Apache's error handler directive, and actually Plack has its ErrorDocument middleware that accepts such error handlers (although the implementation is a bit rough).

This probably does not need a revision in the PSGI spec itself, but could have a standardized/common way to specify such error handlers across server implementations.

Because you specify two different PSGI applications, developers have a complete control of specifying what to do in the error case, which might be useful if you want to deploy a PSGI application written by third party (such as the one on Github or CPAN).

The downside would be you possibly have to duplicate the middleware stack, both for the main application and error handler application, and if you need to share some resource such as open UNIX socket or file handle, it might be difficult or impossible, depending on what you want to do.

from psgi-specs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.