if else conditions working fine in the localhost but not working after I hosted.
const productDetails = async (req, res) => {
  try {
    userSession = req.session;
    const id = req.query.id;
    const products = await Product.find();
    const productData = await Product.findById({ _id: id });
    if (productData) {
      res.render("singleProduct", {
        isLoggedin,
        id: userSession.userId,
        product: productData,
        products: products,
      });
    } else {
      res.redirect("/home");
    }
  } catch (error) {
    console.log(error.message);
  }
};
<% if(id) { %>
    <%- include('../partials/userLoggedinHeader') %>
    <% }else { %>
    <%- include('../partials/userHeader') %>
    <% } %>
<% if(id){ %> 
<a class="primary-btn" onclick="addToCart('<%=product._id%>')">Add to Cart</a>
<a class="icon_btn" onclick="addToWishlist('<%=product._id%>')"><i class="lnr lnr lnr-heart"></i></a>
<% }else {%> 
<a class="primary-btn"  href="/addToCart?id=<%=product._id%>">Add to Cart</a>
<a class="icon_btn" href="/AddToWishlist?id=<%=product._id%>"><i class="lnr lnr lnr-heart"></i></a>
<% } %>
here I have rendered id and it is working fine in localhost but the second 'if' not working after I hosted using aws and nginx. Can someone tell me what's happening here?