Refreshing Angular universal routes behind IIS URL Rewrite reverse proxy gives 404 - iis

I'm trying to configure a deployment in IIS 6.0 that contains the following apps:
APIs: ASP.NET MVC Application
Server-Side Rendered frontend: Angular Universal application listening to port 3000
I've deployed the .NET application to IIS and created a URL rewrite rule of reverse proxy type (using URL rewrite module), that maps inbound traffic to localhost:3000 which is running the angular universal.
The website loads successfully but when I try to refresh the loaded angular default route URL example (domain.com/main/home), the server returns Error 404.
I've searched online and found an alternative solution using (IISNode) but it is not working as supposed
the rewrite rule is as follows
rewrite rule

Related

URL Rewrite is not working for http to https redirection on IIS

I have two applications hosted under default Web Site on IIS 10.
For one application(for which I am using default port:443) I am able to redirect http request to https using URL Rewrite.
but for other application I am not able to achieve this(It has other port number eg:9000).
Thanks in advance!

Setting SonarQube for SSL using IIS and Reverse Proxy throws 502 error

I am trying to setup SonarQube with SSL on Windows Server 2019. I can access the SonarQube server locally on the server using http://localhost:9000.
I followed the exact steps as outlined here to setup reverse proxy in IIS using URL Rewrite module. I see the Re-Write URL set to http://http://localhost:9000/{R:1}
However when I browse https://sonarqube.mydomain.com I get the error below
502 - Web server received an invalid response while acting as a gateway or proxy server.
Is there anything i need to enable in SonarQube to enable Reverse Proxy?
I could not find anything in website's logs %SystemDrive%\inetpub\logs\LogFiles
found it
I don't know why URL Rewrite module was adding URL as http://http://localhost:9000/{R:1}
I manually changed it to http://localhost:9000/{R:1} and it worked

Can I run a node and aspnetcore in the same AppService?

I have a nodejs application as the frontend and built my api in apsnetcore webapi. I'd like to run the api in the same domain i.e. /api. However I'm presented with runtime environment question when creating app service where I have to choose between dotnetcore and node. Anyone know how to get this to work?
Looks like you can from the link here if you
"tweak URL Rewrite rules in web.config so that specific URLs are being handled by IISNode and the other ones by ASP.NET."

Redirect if hostname is incorrect with Node

We have a site hosted on IIS using http (port 80)
and we have a new site hosted on Node using https (port 443)
For reasons I won't go into too much, we can't use IISNode to run all websites on IIS.
This setup works unless someone uses https to reach one of the IIS hosted websites.
to reproduce:
http://nameprintgraphics.com -> IIS website
https://npgcloud.com -> Node website
if you type in https://nameprintgraphics.com however, you go to the node website. I want to prevent this behaviour. Since node is listening to port 443, is there a way to validate the hostname and if it's incorrect, redirect the user to http.
I know this is a bit of a convoluted way to fix things, but please work with me to find an interim solution to this problem. IISNode is preventing a legacy silverlight app from working in IIS for reasons I have yet to determine.
Why not check req.headers.host in your node app and if it matches, then simply send a redirect response immediately? For example:
// You may/may not want to append the `req.url` to the destination as well
res.writeHead(302, { Location: 'http://nameprintgraphics.com' });
res.end();

Integrating node.js and express website with wordpress hosting

I have a website running on node.js and express, hosted on Amazon EC2 with a normal domain (e.g. www.example.com)
We want to add a blog to the website. We would like the blog route to be www.example.com/blog
I have tried a Ghost installation under node.js (with a proxy layer to handle the port and url remap). I got it working ok, but the feature set is not robust enough for our content creators. They would rather work with WordPress.
But WordPress does not have a node.js install, and I do not have the bandwidth to set up and run a WAMP server in addition to the node.js server we currently use.
So I am investigating using a another hosting option for wordpress and using a proxy layer to redirect to the hosted wordpress blog.
From what I have read online, WordPress hosting will not work (cannot configure the URL properly on the WordPress side). And I could not get the proxy layer to work with a test account.
Will a 3rd party (like GoDaddy) work?
I am envisioning that we host the blog on GoDaddy. And on our site, I set up a proxy to map www.coursehunter.org/blog to the GoDaddy hosted Wordpress blog. Has anyone done this? Does it work technically? I understand I would probably have to edit the .htaccess file.
Are there SEO gotchyas from an implementation perspective? The main point of our blog is to build out content for our main domain which is why we want the www.example.com/blog url.
Thanks!
I would suggest you look into Nginx web server. You can set it up as a reverse proxy for your NodeJS/Express web application and install its php-fpm module to handle the PHP part(Wordpress).
Here is a guide to set up Wordpress with Nginx https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
And here is one with set up your NodeJS application with Nginx https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04
In your case, you will need to setup the url configuration so that the parts get routed to the correct destination that is NodeJS part is handled by reverse proxy and Wordpress is handled by php-fpm

Resources