I have a web app consisting of a React.js front end and an Express.js back-end server which listens to incoming requests on port 7000. I'm using Nginx on my Ubuntu server to route my domain (let's call it example.com) to the javascript server process.
When I go to http://example.com in the browser The HTML document of the homepage is returned successfully, but when trying to get index_bundle.js or favicon.ico the requests fail (getting net::ERR_CONNECTION_REFUSED) because they use HTTPS instead of HTTP (of course I will set up SSL when deploying to production, but this is a testing server).
For example, the script tag which tries to get the main bundle script looks as follows: <script defer="defer" src="index_bundle.js">. As you can see, it's a simple relative path to the script on the server, but the request URL appears as https://example.com/index_bundle.js even though the original request in the browser explicitly used http://.
Is there a way to make the app use the non secure version of http as long as I'm using the testing environment? Am I doing something wrong?
My Nginx configuration file: (etc\nginx\sites-available\default):
server {
return 404;
}
server {
listen 80;
server_name example.com;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:7000;
proxy_redirect off;
}
}