Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

spring boot - How to achieve to get a request, forward it to my application then forward it to the original address?

So at the moment there is a Client that sends the data to Database.

I would like to setup an Nginx proxy between the Client and the Database.

I would like to make the route from Client -> Database to Client -> My spring-boot app -> Database where my spring-boot app make some changes on the data.

For example if I send the following json to Database to store, I catch it with my spring-boot app and I change something. If the client want to save the following data:

{ "name": "Jack", "age": 25 }

I get this request at my spring-boot app and I can change it to:

{ "name": "Jack Sparrow", "age": 250 }

And the database get this and the Database will store the "Jack Sparrow" and "250" and not the "Jack" and "25".

How can I achieve that?

(also I would like if the Client requests the data, my application get the data first and then changes back to its original value. So client asks for the

{ "name": "Jack Sparrow", "age": 250 }

data but it gets back the

{ "name": "Jack", "age": 25 } )

Of course I am not asking about the spring-boot app, but the Nginx configuration.

Thanks in advance.

question from:https://stackoverflow.com/questions/65559625/how-to-achieve-to-get-a-request-forward-it-to-my-application-then-forward-it-to

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...