Skip to content

I need a ServerHTTP, But not in Serverless. #5282

@litecy

Description

@litecy

In our business, we need to apply overall encryption and routing wrapping to certain domains and endpoints. The actual backend uses the same set of APIs, and it should also work in non-encrypted mode.
For example:
APIs: a, b, c, d
Main business domain: X
Encrypted business domains: Y, Z

In normal mode, the following are accessible:
X/*, Y/a, Y/b, Z/a, Z/b

The endpoints that require encrypted access are:
Y/c, Y/d, Z/c, Z/d

Before go-zero version 1.8, we registered an additional encrypted route n, attached a middleware m to n, and in m we decrypted the request, rebuild the aim request, then called Server.ServerHTTP, and finally re-encrypted the response.

After version 1.8, ServerHTTP was removed. I tried using Serverless, but Serverless and the normal mode cannot coexist.

Would it be possible to add a wrapper that supports ServerHTTP, or add an initialization method in Serverless that does not call build?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions