AWI IT
asked on
Azure Web App - HTTP Redirect - web.config file help
Hello,
I have been trying to setup a Azure Web App with a custom domain name record and web.config file which can take care of http redirections for our domain.
I've configured the web app based on this technet article.
https://social.technet.microsoft.com/wiki/contents/articles/32229.azure-create-an-url-rewrite-azure-web-app.aspx
After following all the instructions I am unable to get the redirection to work. Here is the web.config file output which I am using.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com” patternSyntax=”ECMAScript” stopProcessing=”true”>
<match url=”http://projects.domain.com” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx" appendQueryString=”false” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
When I try to connect to projects.domain.com I receive the following message.
The page cannot be displayed because an internal server error has occurred.
Can anyone please help me understand what I am doing wrong here?
Thanks.
I have been trying to setup a Azure Web App with a custom domain name record and web.config file which can take care of http redirections for our domain.
I've configured the web app based on this technet article.
https://social.technet.microsoft.com/wiki/contents/articles/32229.azure-create-an-url-rewrite-azure-web-app.aspx
After following all the instructions I am unable to get the redirection to work. Here is the web.config file output which I am using.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com”
<match url=”http://projects.domain.com” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx" appendQueryString=”false” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
When I try to connect to projects.domain.com I receive the following message.
The page cannot be displayed because an internal server error has occurred.
Can anyone please help me understand what I am doing wrong here?
Thanks.
ASKER
Hi,
Yes I had that in originally and it still did not work. Same error message.
Any other ideas?
Yes I had that in originally and it still did not work. Same error message.
Any other ideas?
The match URL needs to (.*).
If is it still not working, you should try adding a condition statement, as recommended in the article you posted.
Dan
If is it still not working, you should try adding a condition statement, as recommended in the article you posted.
Dan
Also, which server is reporting the internal error? The redirect may be functioning and it may be the destination website may be throwing the error.
Dan
Dan
What happens when you do directly to this URL: https://domain.sharepoint.com/sites/pwa/default.aspx
Or whatever the destination of the redirect is.
Dan
Or whatever the destination of the redirect is.
Dan
ASKER
I originally had exactly the same information listed pin the article in mt web.config file.
I changed it to see if it would work.
Still have not been able to get it working.
I changed it to see if it would work.
Still have not been able to get it working.
Can you answer my last question?
Dan
Dan
ASKER
Okay I have changed the web.config file back to the original, plus the deafult.aspx. Still no joy :(
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com” patternSyntax=”ECMAScript” stopProcessing=”true”>
<match url=”(.*)” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx” Jump appendQueryString=”false” redirectType=”Permanent” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”projects\.domain\ .com” />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com”
<match url=”(.*)” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx” Jump appendQueryString=”false” redirectType=”Permanent” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”projects\.domain\
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
ASKER
You wanna help me via live consultant? Go online.
You use teamviewer?
You use teamviewer?
ASKER
The destination URL works fine;
https://domain.sharepoint.com/sites/pwa/default.aspx
This loads the main project online page.
https://domain.sharepoint.com/sites/pwa/default.aspx
This loads the main project online page.
ASKER
One thing I didn't do is apply a certificate to the web app service. Do you think this could be causing an issue?
How can I see the logs for this web app?
How can I see the logs for this web app?
ASKER
Just want to confirm, my wwwroot only has the one file in it; web.config.
Should there be anything else uploaded, or should it work with just the single file?
Should there be anything else uploaded, or should it work with just the single file?
I would place a default doc in the root of the website. This way you can see that you are hitting the site.
As a test, disable the redirect (URL Rewrite), place a test html page in place. Does this page get displayed correctly?
Dan
As a test, disable the redirect (URL Rewrite), place a test html page in place. Does this page get displayed correctly?
Dan
ASKER
I removed the web.config file and copied in a default.html file with hello world inside it.
When browsing to the URL it worked. It displayed hello world in the browser.
What I did notice is that the URl for the site is http://projects.domain.com....what I'm trying to do is get it to re-direct and re-write the URL.
So if you put in your browser http://projects.domain.com > it redirects and changes the URL in the browser address bar to https://domain.sharpoint.com/sites/pwa/default.aspx.
At the moment it leaves http://projects.domain.com in the address bar... so maybe that need tweaking. ???
When browsing to the URL it worked. It displayed hello world in the browser.
What I did notice is that the URl for the site is http://projects.domain.com....what I'm trying to do is get it to re-direct and re-write the URL.
So if you put in your browser http://projects.domain.com > it redirects and changes the URL in the browser address bar to https://domain.sharpoint.com/sites/pwa/default.aspx.
At the moment it leaves http://projects.domain.com in the address bar... so maybe that need tweaking. ???
ASKER
I'm looking for the equivalent of a 301 redirection. This is what dnsmadeeasy call it in their http redirection service.
I understand what it is that you are trying to do. I just wanted to step back and verify that the website was functioning.
Now that the site has been verified as functional, we can try the redirect.
Just to be clear, you are placing real URLs in the web.config, correct? I would create the redirect rule as mentioned in the article and test again.
Dan
Now that the site has been verified as functional, we can try the redirect.
Just to be clear, you are placing real URLs in the web.config, correct? I would create the redirect rule as mentioned in the article and test again.
Dan
ASKER
When you say "real" URL's, yes I am placing my URL's in the web.config file that actually exist in reality. If I browse to https://domain.sharepoint.com/sites/pwa/default.aspx, it works and really exists and produces a website for project online project center.
I've created the web.config file exactly like it states in the article.
Here it is again, this is exactly what is in my web.config file now, apart from the word "domain" being swapped with my company domain name:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com” patternSyntax=”ECMAScript” stopProcessing=”true”>
<match url=”(.*)” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx” Jump appendQueryString=”false” redirectType=”Permanent” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”projects\.domain\ .com” />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I've created the web.config file exactly like it states in the article.
Here it is again, this is exactly what is in my web.config file now, apart from the word "domain" being swapped with my company domain name:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”projects.domain.com”
<match url=”(.*)” />
<action type=”Redirect” url=”https://domain.sharepoint.com/sites/pwa/default.aspx” Jump appendQueryString=”false” redirectType=”Permanent” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”projects\.domain\
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for picking up on some errors there. Just want to confirm that the bracket is required in this section
pattern="{projects
pattern="{projects
ASKER
After deleting the { bracket it is now working!!!
Well done Dan, I feel a little embarrassed that I didn't notice these errors myself.
Really appreciate all your help to get this working! :)
Well done Dan, I feel a little embarrassed that I didn't notice these errors myself.
Really appreciate all your help to get this working! :)
Oh, the bracket was my typo. Glad its working now.
Dan
Dan
ASKER
Thanks again Dan. Really appreciate you helping me out here.
No problem. Can you close the question?
Dan
Dan
to this:
Open in new window
it should work. This is directly from the documentation you provided. Though this will redirect ALL traffic to this Azure instance, not just the FQDN because you have no condition setup.
Dan