I'm running an Azure Web App that's meant to accept XML Posts. When I post to the urls using cURL everything works, however, when using Apache Camel/HTTP the POST results in a 400 error. When I look at the log files, the only difference is cs-host field. For the cURL commands the value is just the domain (e.g. azurewebsites.net), however the Apache POST appends port 80 (e.g. azurewebsites.net:80). I added a rewrite rule that would strip the port from the call (rule details below), but the POST still results in 400 error. The closest related post I could find was here: Including Port number in HTTP HOST header causes Service Unavailable error but unfortunately it looks like it's related to Netscaler, not Azure Web App, and the resolution didn't provide any detailed guidance.. Thanks for any input!
Here's the rewrite rule:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="domain" xdt:Locator="Match(path)">
<system.webServer>
<rewrite xdt:Transform="InsertBefore(/configuration/location[(#path='domain')]/system.webServer/*[1])">
<rules>
<rule name="domainrule1" stopProcessing="true">
<match url="domain.azurewebsites.net:80(.*)" />
<action type="Redirect" url="http://domain.azurewebsites.net/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
<location path="~1domain" xdt:Locator="Match(path)">
<system.webServer>
<rewrite>
<rules>
<rule name="domainrule2" stopProcessing="true" xdt:Transform="Insert">
<match url="domain.azurewebsites.net:80(.*)" />
<action type="Redirect" url="http://domain.azurewebsites.net/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
</configuration>
Related
I'm using IIS as a reverse proxy to avoid CORS issues for data fetching. I'd like to store auth data (client id and secret) in the web.config and create a request body that gets included with the matching request. Is this possible? If not, is it possible to add that info to a header?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
...
<rule name="proxyRule" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://dataserver/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I want to know if anybody here can help. I have using Nest.js for my program and I have added some web socket code into my program for some new feature. However, when I deploy to the server and there are a problem to the IIS Setting.
Now I use URL rewrite for my http server. My HTTP server run on port 8200 in localhost. My web socket port is 8085. What I have tested is that I can call it in local using ws://localhost:8085/socket.io/?EIO=3&transport=websocket and also ws://192.168.X.X:8085/socket.io/?EIO=3&transport=websocket in internal network. However, I cannot call by ws://myurl.com/socket.io/?EIO=3&transport=websocket. The URL is binding with a IIS server. Below is my IIS server web.config. Is it because we socket cannot called by url? or is my web.config have something wrong? Can anybody help me?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WebSocketsReverseProxy" enabled="true" stopProcessing="true">
<match url="ws://(.*)"/>
<action type="Rewrite" url="ws://localhost:8085/{R:1}"/>
</rule>
<rule name="HttpsReverseProxy" stopProcessing="true">
<match url="(.*)"/>
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://"/>
</conditions>
<action type="Rewrite" url="http://localhost:8200/{R:1}"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
remove ws:// from the first rule. iis match rule only matches folder or file but does not match the domain name. if you want to match the domain use condition server variable {HTTP_HOST}.
I have an IIS 10 server configured as a basic URL Rewrite reverse proxy to preauthenticate requests directed at another web server, the calls are all presenting client certificates over SSL. I'm having issues with (413) Request Entity Too Large errors with large POSTs.
I've tried setting this in applicationHost.config
<serverRuntime uploadReadAheadSize="2147483647" />
However this had no effect. Are there any other settings that control URL Rewrite's rejection of large POSTs?
The web.config for the reverse proxy is very simple:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://my.internal.server:444/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
To sum up from the comment.
Try changing <httpRuntime maxRequestLength="4194304" /> first.
If it doesn't work try <requestLimits maxAllowedContentLength="2147483647" /> next.
If it stills doesn't work leave me a comment.
Normal setting for max upload file size:
Setting the request limits in the root web.config of the site (default is 30 MB). This can be set in Internet Information Services Manager Program also (MACHINE->Site->IIS->Request Filtering->Edit Feature Settings)
<!– 100 MB . Format uses Bytes –>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength=”102400000″ />
</requestFiltering>
</security>
My goal is to be able to access this URL from remote machine via IIS Rewrite:
http://host:5000/#!/room/5963bdd51eeaa415988ec6d9
using the following URL:
http://{host}/chat/
Here's my web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="chat" stopProcessing="true">
<match url="chat/*" />
<action type="Rewrite" url="http://127.0.0.1:5000" />
</rule>
</rules>
<outboundRules>
<rule name="chat" preCondition="">
<match filterByTags="A, Area, Base, Form, Head, IFrame, Img, Input, Link, Script" pattern="chat/*" negate="false" />
<action type="Rewrite" value="http://127.0.0.1:5000" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
Anything I'm doing wrong? Thanks
Since this is a outbound rule, your client will receive the address as http://127.0.0.1:5000. Assuming the client machine has no application installed at port 5000, you will run into an error.
Try using a Inbound Rewrite rule (If you dont want the URL to change on the browser) or Inbound redirect rule (if you want the URL to change on the browser) with the same parameters and let the server do the talking.
A server (x.com) has the following parameters:
- It is accessible from the outside from port 80.
- It has an internal service running on port 1000.
- The service needs to be accessible from a subdomain (service.x.com)
Running IIS on Windows 10, I did the following:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="URL Rewrite" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://localhost:1000/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
And it worked beautifully.
The same code, on the other end, run on Windows Server 2012 R2 yields this:
HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
Module IIS Web Core
Notification MapRequestHandler
Handler ExtensionlessUrlHandler-Integrated-4.0
Error Code 0x8007007b
I do not understand why it works on one version of IIS and not on the other one.
I found: ARR (Application Request Routing) needs to be enable.
Of course, this is not mentioned anywhere in any of the error messages nor in log.