Closed t83714 closed 4 years ago
Removing createGenericProxy
from codebase -- simplicity is good.
Removing
createGenericProxy
from codebase -- simplicity is good.
Yeah~ I recently added createGenericProxyRouter
just for it.
it (createGenericProxyRouter
) works as a more consistent way to proxy either API routes or web routes and it also helped to reduce some code duplication.
Allow default web route to be configured like all other web routes (allow specify methods, auth etc.)
2928 already made
webRoutes
be able to configure with more options (e.g. auth, method etc).However, the default web route still use (and the only one)
createGenericProxy
https://github.com/magda-io/magda/blob/d3f85b69e69f325f7712b412a63336299286372f/magda-gateway/src/buildApp.ts#L270
Due to security concerns, we probably can't hardcode
createGenericProxy
to proxy all methods and should let the user to config instead.Also, we will want the helm config to be compatible with the existing config (easier to upgrade existing sites).
Thus, propose the following solution:
Possible Solution:
web
field config here still works as before. i.e.defaultWebRouteConfig
section that allows to config allproxy target
options. i.e.:methods
: array of string. "all" means all methodsauth
: whether this target requires session. Otherwise, session / password related midddleware won't runredirectTrailingSlash
: make /xxx auto redirect to /xxxx/statusCheck
: check target's live status from the gatewayweb
config field abovecreateGenericProxy
from codebase (only default web route uses it now) and usecreateGenericProxyRouter
instead for proxying default web route.