Is there a way to set up IIS to host my NodeJS REST API on a unique URL without having to expose any additional ports?

Recently, my organization provided me with a Windows Server running Windows Server 2019 and IIS. I have successfully configured PHP and MySQL to host my website on this server using IIS.

However, I have now developed a new service using Node.js that serves a REST API on port 3000 locally.

Due to my organization's security policy, I am not allowed to open custom ports for applications. Therefore, I need to find a way to serve my Node.js REST API through https://example.com/nodejsapp.

I would appreciate any suggestions on how to achieve this, whether by serving the Node.js app using a directory in the default website or any other approach you may recommend.

Thank you in advance for your help.

As an update, I attempted hosting a separate site on IIS and stopping the default site, which allowed my Node.js app to work correctly.

Answer №1

If you're looking to connect to the REST API through port 3000 by typing https://example.com/nodejsapp (which defaults to port 443) into your browser's address bar, you can utilize reverse proxy and URL rewriting in IIS.

For detailed instructions, check out this blog post: Setting up IIS with URL Rewrite as a reverse proxy for real world applications

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Managing multiple NodeJS applications simultaneously

Is it feasible to execute 3 or more nodeJS Applications using a single command through a shell script? The concept involves having a shell script that navigates into the app directories and runs the npm command. Using the npm package concurrently is not ...

Encountering a syntax error when running newman on an Ubuntu system

Just starting out with newman and looking to integrate it into my CI\CD pipeline (specifically VSTS). I've been able to export my collection.json and env.json files, but running the tests is giving me some trouble. newman run Dev-.postman_collect ...

Issues with Cross-origin resource sharing (CORS) arise when attempting to delete data using Angular

I am facing an issue with my Angular app (v1.13.15) and Express.js(v4.12.4) backend. Specifically, I have set up a DELETE method in my backend and enabled CORS support for it. However, every time I attempt to use the Angular $http.delete function, I enco ...

Error: The call stack has reached its maximum size while running an npm install

Attempting to execute npm install, encountered the following console output: npm ERR! Linux 4.8.0-27-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! node v6.9.1 npm ERR! npm v3.10.8 npm ERR! Maximum call stack size exceeded npm ...

Error: invoke(err) stack trace

Whenever I encounter an error using next(err), pinpointing where it occurred becomes a challenge for me. Is there a method to capture the stack trace in order to trace back the error to its source files? (Even if it's a validation error, I'm inte ...

When navigating using links in NodeJS+Express, I am unable to load the CSS files

I am a beginner with Node.js. Below is the code I used to make the server run in index.js: var express = require('express'), views = require('./routes/views'); var app = express(); // Get an instance of router //var router = ex ...

Setting up a node module from a globally installed instance

Here's a scenario: I'm going on a vacation without internet access, but I brought my laptop along to work on some coding. I have a habit of using the global flag when installing node modules, which leads me to believe that they are added locally. ...

The Express Json Validator Middleware will return a 404 error code if there are no errors in the JSON body

I am struggling to have this application return a 200 status code and an empty json response when there are no validation errors in the json request body. However, the app always returns a 404 error. The application utilizes expressjs along with the expre ...

Is there a way for me to simultaneously run a typescript watch and start the server?

While working on my project in nodejs, I encountered an issue when trying to code and test APIs. It required running two separate consoles - one for executing typescript watch and another for running the server. Feeling frustrated by this process, I came ...

What is the conventional method for sending data by utilizing the output of a previous data submission in Node.js with Express and FaunaDB?

I am in the process of revising a project and have a question about how to post an array of data using the return value of a previous post request as the ID. Here is an overview of the data structure: Checklist A [ChecklistItem 1, ChecklistItem 2, Checkli ...

Unexpected token error occurs when making cross-domain AJAX requests to the server and receiving a JSON object

I have set up an express server to handle get requests to specific url endpoints. When responding to these requests, I am sending back data in JSON format to enable making Ajax calls and retrieving data from the page. To allow for cross-domain requests, I ...

Importance of having both package.json and package-lock.json files in an Angular project

As a newcomer to Angular, I recently installed a sample app using angular-cli and noticed the presence of both package.json and package-lock.json files. The package-lock.json file contains specific dependencies, while the package.json file includes other i ...

(Angular4 / MEAN) Making a Request to Local API Yields an Empty Response Body

I'm attempting to send data to an Items API, like this: "data": { "title": "stack", "notes": "asdsad", "time": "19:02", "meridian": "PM", "type": "Education", "_id": "5a2f02d3bba3640337bc92c9", ...

Utilizing Mongodb for complex query conditions

I am new to using MongoDB and express for database interactions. My goal is to query the database based on URL parameters by extracting them from the URL and adding them to an object if they exist in order to use them when querying the database. I have s ...

Having trouble making a POST request from Alamofire to ExpressJS

My backend server is NodeJs / ExpressJs running on Ubuntu 18.04.3 LTS. When I send AJAX GET or POST requests from the front-end (JavaScript) or through POSTMAN, everything works perfectly as expected. However, when I make a POST request using Alamofire in ...

An unforeseen vow in lieu of an assortment

I'm currently working on a project involving node and mongo. To achieve parallel requests, I am utilizing a netlify serverless function that will be built using data from mongo records. Here's what I have done so far: paralellNum = 2; const filt ...

How can you selectively export a single function from a JavaScript file?

Within my project, I have two separate modules - one written in ts and the other in js. There is a utility within the js module that needs to be accessed by the ts module. The utility service.js looks like this: module.exports = { helloFriends: functi ...

Switch between selecting every group of 3 items and every group of 4 items

Having an array with more than 14 items, I need to group them into 2 different groups in this specific way: The first 3 (#1,2,3) will be in array A, the next 4 (#4,5,6,7) will be in array B, the following 3 (#8,9,10) will be in array A, the subsequent 4 (# ...

Converting nested arrays within a JSON object to a CSV format

I am currently utilizing the 'json-csv' library to convert a user's arrays with nested objects and arrays into a CSV format. var users = [ { subscriptions: [ { package : { name: &a ...

Troubleshooting static resource serving in Node.js on OpenShift

After setting up a basic node0.10 cartridge on OpenShift, I encountered an issue with my index.html file where I couldn't access certain files from the node_modules folder. Instead, I kept receiving 404 http errors. The imports in my index.html are s ...