X-forward-for question

Hello,

I plan to set up two servers for a training purpose : one frontend, one
database.

I created a tcp server but I need to be sure of the idea :

Be F the frontend and B the backend.

when a client will make a request, it will hit F first (nginx + https
involved) then will ask B to process the query with adding a
x-forward-for
header not to lose the real client ip and port.

Then my tcp server will retrieve those headers, then ask the script to
perform the database connection/query… via fastcgi.

Then what should I do ? Should I just send a request back to nginxwith
the
afformentioned headers and nginx will set it out properly and re-encrypt
the
connection ?

I am a bit lost here but I need to improve myself on this field.

Thanks

Is it how it works ?

Posted at Nginx Forum: