ECONNRESET: Request could not be proxied

workspace
javascript
nodejs

#1

Hey,

I’m a novice working with js/node in my workplace. My app runs smoothly, but when I redirect to certain routes, I get the _ECONNRESET: request could not be proxied_ error.

I read different threads about this problem, and I realize it’s an HTTP vs HTTPs conflict. However, I’m not really sure how to make my port listen to a certain protocol. I’m using:

app.listen(process.env.PORT, process.env.IP, function () {
console.log(“Server is running!”);
});

I hope I addressed the problem clearly. Any help would be appreciated!

Cheers,


#2

this is more likely an issue with not calling req.end from the route that redirects. could you show an example code for one such route


#3

UPDATE: Fixed. I redirected instead of rendering the form.

it’s an edit get route for to redirect to a comment edit form

Edit route:
router.get("/:commentid/edit", function(req, res){
Comment.findById(req.params.commentid, function(err, foundComment){
if(err){
res.redirect(“back”);
} else {
console.log("comment ID is: " + req.params.commentid);
res.redirect(“comments/edit”, {camp_id: req.params.id, comment: foundComment});
}
});
});

The edit anchor tag:
<a class="btn btn-xs btn-warning" href="/campgrounds/<%= camp._id %>/comments/<%= comment._id %>/edit">Edit</a>

Hope this helps. Thanks!