Skip to content

Two different independent middleware stack merged #10

@fiatjaf

Description

@fiatjaf

My intention is to have something like this:

                                 +----> a set of middleware +----> route handlers -+
                                 |                                                 |
                                 +                                                 |
                               header                                              |
Request -> logger -> CORS +--- based                                               +----> end request
                               match                                               |
                                 +                                                 |
                                 |                                                 |
                                 +----> other set of middleware +> route handlers ++

I've tried to adapt the example at https://github.com/carbocation/interpose#nested-middleware-adding-headers-for-only-some-routes to something that could work and ended up with https://github.com/fiatjaf/summadb/blob/two-different-submuxes/handle/main.go.

However, it is not working. Although the matcher functions are being called and returning correctly, CORS doesn't work, and I don't know what else isn't working.

How should I proceed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions