Subversion behaving weirdly behind reverse proxy - iis

I'm trying to migrate a Subversion server to a different machine, which is also already running IIS. Thus, I configured Subversion to run at port 81, and set up an IIS rewrite rule based on the host name:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="svn.foo.example" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^svn.foo.example$" />
</conditions>
<action type="Rewrite" url="https://svn.foo.example:81/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
In addition, "server proxy settings" are configured as follows (I think I left all of these as defaults):
enable
version pass through
keep alive
120-second timeout
reverse rewrite host in response headers
preserve IP in X-Forwarded-For
(The SVN server is VisualSVN 4.3.4; the IIS is Windows Server 2019 Version 1809.)
Where things get strange is that some stuff works, including on existing working copies. For example, I can:
use an existing working copy
add a file to that folder, and commit it
check that file's log
However:
use an existing working copy
check the log of a folder // works!
check the log of an existing file // does not work!
The latter fails with E160013: File not found. Indeed, if I look in the IIS logs, it returns 404.
If I instead (locally) check out that same file without the reverse proxy, I can get its log, so presumably, it's a problem with the proxying. But then why does it work if I add new files and check their logs?

Related

Nest JS Web Socket IIS Web.config setting

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}.

IIS reroute just one site to Apache

I'm trying to figure out how to reroute just one of our sites from IIS to Apache. I've followed several online tutorials and posts and nothing is working. I keep getting:
I've read that I need to do a reverse proxy using the URL Rewrite feature of IIS. So I did that and here are my settings:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" destination="" />
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8088/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Apache is on 8088 and if I hit localhost:8088, it works just fine. I've also added IUSR and IIS_IUSRS users to the directory permissions both having read and execute, list contents, and read permissions. I wouldn't think this would be that terribly hard.
When you need to rewrite IIS to apache, please remember to install ARR.
https://www.iis.net/downloads/microsoft/application-request-routing
Then please remember to enable Server node->application request routing cache->Server Proxy setting->Enable proxy.
Besides, could you access orchestrator.local without URL rewrite rule. Because, if this issue is caused by IIS, you should receive status code more than site can't be reached.

URL Rewrite Reverse Proxy on IIS only working on the server its self

I'm currently trying to set up a Gitea server on my Windows server 2016 standard server with Plesk installed. I have a subdomain setup which is git.thetofushop.net and I'm trying to make a Reverse proxy to point to the Gitea server which runs on port 3000.
this is my web.config for the subdomain
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://149.56.184.96:3000/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
But this only works internally on the server itself, it is not working outside of the server. You can visit the IP and port, but the reverse proxy point blank refuses to work. Now I'm not super adept with IIS, but I've tried what I can figure out from what I've found. If someone can give me a reason and an exact steps to fix this id. I am also open at this point to allowing someone to TeamViewer in and fix it as I've been trying to figure this out for 8 straight hours.
Thanks in advance

IIS Url Rewrite overwriting external urls

On my development machine, I am trying to configure IIS as a reverse proxy to forward requests coming in port 443 to a nodejs application running locally.
The requests are getting forwarded fine, but sometimes the the nodejs application tries to redirect the browser to an external site and the IIS url rewrite module change that also to point to the local server.
I am accessing the site using https://localhost/test
IIS reroutes the requests to the node app http://localhost:14819/test
The node app returns an http 302 with location header set to https://example.com/someroute
IIS transforms this to https://localhost/someroute
I want the external urls to be untouched by IIS. How to do this?
Here is my Web.config content
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="ReverseProxyInboundRule1" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^test(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^localhost" />
</conditions>
<action type="Rewrite" url="http://localhost:14819/test{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you have any redirect coming back from the backend proxy and you do
not want to redirect the Location header coming ,You can do that by
unchecking "Reverse rewritehost in response headers" in Application
Request Routing
Select the server node in IIS manager
Go to Application Request routing Cache
Click on Server proxy Settings
UnCheck "Reverse rewritehost in response headers"

IIS rewrite to local apps - fails with 404

I want to use IIS8 to route traffic from ports 80/443 to two applications running on the same server - one sitting on port 8080 (node.js app, running as a separate service), another on port 8090 (a .NET application, running on the same IIS, handling api calls).
I have setup an app on port 80, with the following web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rewrite api to backend calls" stopProcessing="true">
<match url="^api/(.+)$"/>
<action type="Rewrite" url="http://127.0.0.1:8080/{R:1}"/>
</rule>
<rule name="rewrite everything else to frontend" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://127.0.0.1:8090/{R:1}"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Unfortunately this approach doesn't work - whatever resource I try to query, I get 404 error.
In the FREB logs, requests are properly translated from OldUrl, to the NewUrl, nothing is found in cache and then the following is mentioned in logs as MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName="IIS Web Core", Notification="MAP_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="4", ErrorCode="The filename, directory name, or volume label syntax is incorrect.
(0x8007007b)", ConfigExceptionInfo=""
Proxy in Application Request Routing had to be enabled as per the IIS Rewrite not working (but redirection does) topic. Issue solved :)

Resources