Assistance with Controlling ESP8266 from Heroku Deploy

Thank you in advance for the help with all of this!

I have set up a website where I can control individually addressable LEDs via the internet using my nodemcu as the microcontroller/server. I have everything working great on my localhost but when I try to deploy it to heroku all of requests fail every time.
I have narrowed it down to 2 problems:

Problem 1: Heroku wants the requests to be in HTTPS but they are in HTTP

Possible Solution 1:

  • Use the WiFiClientSecure Library to convert the requests to HTTPS

  • I have not gotten this solution to work with the way my nodemcu is set up, and would greatly appreciate any advice on how to make it work.

  • This is the example that I found and was recommended by multiple articles

  • HTTPSRequest

  • This example is making a get request on start up to the GitHub api

  • My goal is to make requests from my website to my nodemcu. I don't understand how I can make that happen.

Problem 2: Heroku doesn't like that I am making requests to a api that doesn't doesnt match its own query url

Possible Solution 2:

  • I have already implemented CORS on the Nodemcu

  • I created this function that gets pass into each route as shown below to allow it to be called from other query urls

  • This is what I initially had to do to get it working on my localhost

  • I feel like I need to do this same sort of thing but on the heroku side

void cors_set_access_control_headers()
{
Serial.println("cors_set_access_control_headers");
webServer.sendHeader("Access-Control-Allow-Origin", "*");
webServer.sendHeader("Access-Control-Max-Age", "10000");
webServer.sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS");
webServer.sendHeader("Access-Control-Allow-Headers", "*");
}

void run_server()
{
httpUpdateServer.setup(&webServer);

webServer.on("/all", HTTP_GET, []() {
cors_set_access_control_headers();
String json = getFieldsJson(fields, fieldCount);
webServer.send(200, "text/json", json);
});
....

I am using my nodemcu as a backend server that I am making get and post requests to from my full stack website. The examples that I found related to my problem seem to be pointing towards making requests from your nodemcu to an api, which is not what I am trying to do and I haven't found a way to utilize the same technique in my situation

This has been a problem that I have not been able to fix for too long now and I really appreciate any advice or help with all of this. Even coding structure tips. I'm trained in Javascript Full Stack Web development so my Arduino/C++ isn't my strong suit.

Here is the code for my main server.ino file
https://github.com/livingkurt/Glow-LEDs/blob/master/server/server.ino

routes.ino
https://github.com/livingkurt/Glow-LEDs/blob/master/server/routes.ino

wifi_setup.ino
https://github.com/livingkurt/Glow-LEDs/blob/master/server/wifi_setup.ino

I apologize if my code is messy, I've just been trying everything to get it to work.