I have the following situation: A frontend server redirects with HTTP Post to a backend server. At entry of the backend server, I execute some PHP code before the page has been loaded. I would like to send a notification, at this point, back to the frontend server that the redirection was successful.
The entry page on the backend uses the Post/Redirect/Get pattern to prevent browser form resubmission alert, so after this the PHP code does a HTTP Get request to itself. After the Get header has been sent, the notification back to the frontend should not be sent from PHP code, to prevent sending it each time the page is refreshed on the backend server.
Can this be done from PHP code, or do I have to wait until the document has loaded and then use an Ajax call from Javascript and somehow check that the notification is only sent once (the first time)?
After all processing was complete, your backend server could redirect back to the front-end server, with any custom data to be passed either as POST vars or url parameters in a GET. The front end server would then handle the UI display of this custom data.
But I think thats a sloppy design... systems should be segregated not just for security reasons, but also for scalability. The best design IMHO would be to make bi-directional AJAX calls between your "frontend" web server to a firewalled, "backend" system.