How to rewrite URL based on http status code (IIS) - iis

I am configuring a IIS reversed proxy that rewrite the URL and redirect request to an IIS server (ServerA) that serves a web service. In the case of failure, for example, a 503 http status code returned by the web service. I would like to rewrite the URL and redirect the request to another IIS server(ServerB) that serves a mirrored copy of the web service. Is this achievable? Thanks!

Related

URL rewrite http to https not working for WCF web application in IIS

I have added URL rewrite for Http to Https for website. But website has many web applications and URL rewriting is not working for web applications. It is showing 404 error
followed this url for http tp https https://www.ssl.com/how-to/redirect-http-to-https-with-windows-iis-10/
added rule to default website. but rule not working for web applications. How to apply rule to web applications too?
https://www.xyz1.com has url. I can see rule on web.config
https://www.xyz1.com/subsite/Testweb.svc - not working. rule not found in web.config

Is HTTPS required on container running on Azure linux app service

I am having following setup, I have deployed public-facing front end application having NGINX web server(with Angular App) on Azure Linux App service, this is part of the docker container.
I am having another Linux app service having .net API.
Now, in order to force HTTPS, do I need to set up https certificates on Azure App service or should I be setting them in the container too where I have Nginx setup?
Second, where and how should I be mentioning the following rules
1. Redirect HTTP request to HTTPS
2. Redirect non-www traffic to www?
You try with:
server_name your_domain.com *.your_domain.com;
return 301 https://www.your_domain.com$request_uri;
SSL gets off-loaded at the front-end of App Services. That means that SSL requests never get to your Web App. You don't need to (and should not) implement any support for SSL into your app.
http://learn.microsoft.com/en-us/archive/blogs/waws/things-you-should-know-web-apps-and-linux#NoSSL

Redirecting from web app behind Azure application gateway

I have two web apps setup in Azure, and for simplicity let's call them webapp1 and webapp2. They sit behind an application gateway, which is selecting the correct web app based on the subdirectory in the URL.
Here's a basic example of how I've set it up:
www.mydomain.com -> webapp1 (the default route)
www.mydomain.com/app -> webapp2
This is working fine, except for one problem: if webapp2 redirects to the login page, for example, the domain in the URL changes to the azurewebsites.net domain. Instead of redirecting to www.mydomain.com/login, it's going to webapp2.azurewebsites.net/login.
I'm fairly new to Azure application gateway, but I know it injects the x-forwarded-* and x-original-host headers. I assumed the gateway would either alter the redirected url request to correct the domain or the config on the web app would use the x-original-host instead. Neither of these things are happening.
Is there a way to configure either the web app or the gateway to make sure the host name doesn't change on redirects? Would this scenario work better with a separate web app/VM with a classic IIS reverse proxy setup instead of the application gateway?
Currently Application Gateway would not overwrite the response from the backend. We do inject X-Original-Host and your application should use that to write the redirect URL correctly back to mydomain.
Example to configure URL rewrite on web app can be found here. An example of rewriting default *.azurewebsites.net domain to a custom domain can be found here

Handling multiple applications under the same domain

I am having a application build using pimcore (ZendFramework) which is hosted on a Linux EC2 (Apache) instance and one more application which is hosted on Windows IIS.
Now I want both of these applications to run in the following manner:
http://example.com/app1 will redirect to pimcore
http://example.com/app2 will redirect to application hosted on IIS
I can't use subdomains for this. I was trying to use URL Rewrite (ARR) of IIS. But ZendFramework is giving the following error:
Zend_Controller_Router_Exception No route, document, custom route or redirect is matching the request
You'll need a third web server to act as a reverse proxy. This could be an Apache or a Nginx instance for example.
The reverse proxy will serve your main domain on port 80 and decide what address to contact in order to provide the appropriate content.

Can I route HTTPS requests to HTTP application, using IIS7 ARR?

I have an application server installed, listening for HTTP traffic on a port which is not blocked from the world by a firewall. I wish to expose the services offered by this application only through HTTPS, preferably as a "sub directory" of the HTTPS site already hosted by the server.
Using IIS7 Url Rewriting (as part of the ARR package), I am able to setup a rule that redirects all traffic to a sub path of my existing HTTPS site. However, I am facing some trouble, when trying to make the same rule route to my server farm setup - all requests matching the rule simply get 404 reponses. Adding the very same rule to a non-SSL site, yields the expected behaviour - the application services are proxied right trough.
What might be wrong in my setup? Is ARR proxying the HTTPS requests as HTTPS traffic to the application server? The application I want to host does not have a HTTPS interfaces so, if yes: can I tell it not to do so?
Yes, I can use IIS7/ARR to route HTTPS requests to HTTP application.
The problem I experienced, was caused by the fact that the web site I wanted to use as the "container" for the proxy directory was buildt with ASP.NET MVC. The URL routing framework within ASP.NET interfered with the IIS url rewriting, and causes the 404 error.

Resources