External App to Meteor


#1

I have an external site sends a POST request to my meteor’s server side app. The external app in localhost:80 is in php, which basically consist of the following code:

$url = "http://localhost:3000/session/new"; // Meteor entry point.
$options = array(

‘http’ => array(
‘header’ => "Content-type: text/html\r\nContent-Length: " . strlen($data) . “\r\n”,
‘method’ => ‘POST’
));

$context = stream_context_create($options);
$fp = fopen($url, 'r', false, $context);
$meta    = stream_get_meta_data($fp);

if (!$fp) {
    echo "Failed!";
} else {
    $response = stream_get_contents($fp);
    echo $response;  // Print the meteor page.
}

The meteor entry point for the above request is the following:

Router.route('SessionNew', {
    path: '/session/new'
}).post(function() {
    this.render('SomeTemplate');
});

The problem is that the root url in the Meteor side of things remains localhost:80 instead of localhost:3000, which messed things up in the browser side when retrieving resources.

(I used POST since I actually send some private data).

For each resource, the following is found.
Failed to load resource: the server responded with a status of 404 (Not Found)


#2

I dont think address start with http:.//


#3

Figured it out. There is no simple way to POST and redirect.

Or unless you can use ddp (which would just replace the POST request).