IIS Rewrite Stopped Working for specific URL - asp.net-mvc

We are trying to integrate OHIF with Orthanc Server. and We are using MVC application to integrate.
When have installed IIS, Orthanc Server on a EC2 machine.
We have configured IIS rewrite, where we will rewrite of the response of the orthanc server.
This was working fine until few weeks back, Now all of sudden the rewrite is not working for few URL. No code changes done.
Please help us on this.
https://book.orthanc-server.com/faq/iis.html
<rules>
<clear />
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="^orthancserver/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://127.0.0.1:8042/{R:1}" />
</rule>
</rules>
All URL Redirect working. And already installed Rewrite Module and I have enabled the proxy too.

Related

http to https redirect url using web.config but getting HTTP Error 500.19 - Internal Server Error

I was try to redirect http to https url using web.config and change in web.config as below code. but it was getting error of "HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid."
But if i remove this code in web.config its working fine. so can you help me what should do change in it or something wrong in it.
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}"/>
</rule>
</rules>
</rewrite>
I think If you want make requests to HTTPS.
You should follow this steps,
SSL Certificate for site should be installed.
Site properly installed and configured for SSL (site set up and binding in IIS configured).
URL Rewrite is installed on the server.
one more thing the code which you written url rewrite it is correct.

Redirect https://domain.com to https://www.domain.com MVC Azure

I'm trying to redirect my MVC website hosted on Azure from:
https://domain.com to https://www.domain.com
domain.com redirects fine to https://www.domain.com
http://domain.com redirects fine to https://www.domain.com
But for some reason https://domain.com will not. It gives a 'This webpage is not available' 'ERR_CONNECTION_REFUSED' in chrome.
I am forcing HTTPS with the following rule in my webconfig:
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
I have seen some answers for apache but this is hosted as an Azure website.
Enabling HTTPS for a custom domain is only available for the Standard mode of web app. Use the following steps to switch to Standard mode.
In your browser, open the Azure Portal.
Click the Browse option on the left side of the page.
Click the Web Apps blade.
Click the name of your web app.
In the Essentials page, click Settings.
There are number of steps to enable SSL on your custom domain on Azure that you need to follow to make it work:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure-ssl-certificate/

"Rewrite to HTTP" rule in web.config broke a Visual Studio local development site

When I added the following https redirect rule to my web.config in my local VS test environment, and then built the app for debug, it gave a 403 on the start page. (The rule itself worked fine in brief standalone test web.config up on Azure.)
After I commented the rule out of the local web.config, I still got the 403. I restored the previous web.config and still got the 403. I then changed the start page, and was able to enter the app, and navigate to the original start page. Then I tried to put the rule back in, and test it all over again, and I started getting config string errors. Finally I restored the entire site from backup, ran it around the whole cycle, and it seems to work.
What might have happened? Did the rule apply to local IIS, and confuse it? And so, should I not add the rule until I deploy the site?
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />

IIS8 and URL redirect using URL Rewrite Module

I have two sites running on a Server 2012 R2 web server:
firstSite, port 80
secondSite, port 1234
Right now, users have to type in the host name, port number, and sub folder in order to view the 'Second Site' http://webServer:1234/subFolder.
I'm trying to simplify the URL so that all users can just type in the URL site.myDomain.com and have it (permanently) redirected to site.mydomain.com:1234/subFolder.
I've tried applying the following rule on my secondSite:
<rewrite>
<rules>
<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<action type="Redirect" url="http://site.mydomain.com:1234/subFolder" />
</rule>
</rules>
</rewrite>
But doesn't seem to do anything.
A CNAME record has already been configured in DNS for site.myDomain.com to resolve to http://webServer.
I just need help with getting the redirection to 'secondSite' at port 1234.
I assume the first site is hosted on IIS and the rule is running within the context of the first site. If so, it should work...to validate your setup, I'd start with this article and the augment with your use case:
http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="/some/folder/path/" destination="/new/folder/" />
</httpRedirect>
</system.webServer>
</configuration>

iis 7 subdomain rewrite reverse proxy to internal servers

On Server2008 systems, ARR/URL rewrite installed. Incoming traffic to ARR server ('pirate.mydomain.com'), that server in DMZ. Internal IIS servers (Server 2008/URL rewrite), single IIS site ('static.mydomain.com') containing dept sub-sites (static.mydomain.com/deptone, static.mydomain.com/depttwo, etc).
At server level on ARR server, ARR server proxy settings: 'enable proxy' enabled, 'useurl rewrite to inspect incoming requests' enabled, 'reverse proxy' set to 'pirate.mydomain.com'.
Intent is to have deptone.mydomain.com rewritten (not redirected) to static.mydomain.com/deptone .... and depttwo.mydomain.com rewritten to static.mydomain.com/depttwo .
URL should not change in the visitors' browser.
At IIS site level for 'pirate.mydomain.com', URL rewrite rule as follows:
<rule name="deptone redirect" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^(www.)?pirate.mydomain.com/(deptone)(.*)" />
</conditions>
<action type="Rewrite" url="http://static.mydomain.com/deptone{C:3}" appendQueryString="false" />
</rule>
THis is not working; I am getting 400.0 error ('max forwards limit').
Need guidance for URL rewrite rule for this process. Have been to the IIS forums/help, but still cannot get this working.
Thanks.

Resources