Both are request-based forwarding. Both are request-based forwarding.
Reply content:
Both are request forwarding.
If I understand it correctly, you are talking about request forwarding and redirection.
There are two essential differences between them.
Request forwardingThe client is imperceptible. For example, in nginx or php-fpm mode, nginx receives requests from php and finds that it cannot be processed by itself, and then forwards the requests to php-fpm for processing, then php-fpm sends the processing result to nginx, and nginx then responds to the client.
RedirectionFrom the client perspective, you can simply understand that two requests are initiated.
Nginx forwarding:
You go to the hot pot restaurant and order a mutton slice. The waiter cut the slice.
You ordered another bottle of ice black tea, and the waiter went to the bar to get it.
It is to assign different requirements to different people for help from the waiter. You only need to communicate with the waiter.
Header redirection/Js redirection:
You go to the hot pot restaurant, "Waiter, come to a Ferrari", the waiter blew you out, "Roll, Ferrari 4S shop across the street"