Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a legacy app middleware to pipeline #22

Closed
wants to merge 1 commit into from

Conversation

dennis-fedco
Copy link

I have a use case where I need to load a legacy app to sit on top of
mezzio front-end, where the legacy app has its own routing structure.

Legacy app is to load when a route is called that is not familiar to
mezzio, and before mezzio issues a 404 error

This middleware acts as a skeleton to use when writing code to load
a legacy app with its own routing structure.

Mezzio app and non-mezzio legacy app should peacefully coexist this way
together, and this relies on mezzio app being able to authenticate
successfully without triggering a 404 error.

I have a use case where I need to load a legacy app to sit on top of
mezzio front-end, where the legacy app has its own routing structure.

Legacy app is to load when a route is called that is not familiar to
mezzio, and before mezzio issues a 404 error

This middleware acts as a skeleton to use when writing code to load
a legacy app with its own routing structure.

The idea is that mezzio and legacy app will peacefully coexist this way
together.  This relies on mezzio app being able to authenticate
successfully without triggering a 404 error.
@samsonasik
Copy link
Owner

The DispatchMiddleware is always executed, processing the RouteResult, and after succesfull logged in, so it goes to the rest of middlewares after it.

As you place LegacyMiddleware after DispatchMiddleware, after logged in, it will always be executed.

If LegacyMiddleware has own routing structure, I think that should be configured in the routes config instead.

Other than that, I don't know.

@dennis-fedco
Copy link
Author

dennis-fedco commented Nov 22, 2021

Thank you. I am trying to find a way where LegacyMiddleware is only executed for the legacy app routes, not for any of the mezzio routes.

I don't think I can realistically put legacy app routes into the routes config, because my legacy app has a very different pre-2010 routing structure. There are a lot of routes (over 200 to 300 I'm estimating) that may also include URL parameters like ?a=b&c=d, accept POST or GET or both. It is a large legacy application and instead of configuring its every route in mezzio, I want to try passing the job of routing legacy routes to the legacy app. I want to still try to explore the LegacyAppMiddleware route until it reaches a dead end, because it seems like the most straightforward way to take. I may need to find a different way to authenticate my users, where LoginPageHandler does not engage LegacyMiddleware on every request.

I should note that the legacy middleware will not die but instead usually return an HtmlResponse() upon a successful legacy route.

@samsonasik samsonasik closed this Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants