Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1854

How to host a Node.js proxy that accepts plain HTTP POSTs on Render? [closed]

$
0
0

I’m working with SIM800L IoT devices that can only send HTTP POST requests (not HTTPS). My backend API is on Vercel, which only accepts HTTPS, so I wrote a small Node.js proxy:

const express = require('express');const axios = require('axios');const app = express();app.use(express.json());app.post("/proxy", async (req, res) => {   try {console.log("Incoming data:", req.body);const response = await axios.post("https://live-trail-server.vercel.app/api/data",  {    trailId: req.body.trailId,    moisture: req.body.moisture,  },  {    headers: {"Content-Type": "application/json","x-api-key": req.body.apiKey,    },  });res.json(response.data);} catch (err) {   console.error("Proxy fetch error:", err.message);   res.status(500).json({ error: "Proxy error", details: err.message });} });app.listen(3000, () => {  console.log("Proxy server running on http://localhost:3000");});

This proxy works locally, but I need to host it online. I tried deploying to Render, but I’m not sure if Render forces HTTPS (which would break SIM800L).

Does Render allow incoming HTTP POSTs on the http://.onrender.com URL, or will it automatically redirect to HTTPS? If so, how can I keep it listening on plain HTTP?


Viewing all articles
Browse latest Browse all 1854

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>