magda-io / magda

A federated, open-source data catalog for all your big data and small data
https://magda.io
Apache License 2.0
513 stars 93 forks source link

Allow default web route to be configured like all other route (allow specify method, auth etc.) #2985

Closed t83714 closed 4 years ago

t83714 commented 4 years ago

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:

mwu2018 commented 4 years ago

Removing createGenericProxy from codebase -- simplicity is good.

t83714 commented 4 years ago

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.