Proxying Crowd not affect outbound rule / result and ends in HTTP response 404 error code
Asked by Kevin Kirchhof:

On proxying my newly setup Crowd instance on a Microsft Server 2012 with IIS8(.5), AAR3 installed, I am having trouble to correctly configure the proxy URL Rewrite rules for Crowd. On setting proxy rules to filter the whole query-string or URL, I am only able to access the configuration/defualt page (query-string: "/") of Crowd. If I now try to rewrite the subdirectory "/crowd", to access the login and configuration panel, I only get the HTTP response with error code 404 and not rewrited URL, containing the subdirectory "crowd" (e.g. "<https://crowd.mydomain.tld/>++crowd++ /{rest-of-query-string}"). I guess that the failed rewrite of outgoing response from Tomcat, containing the subdirectory "crowd" in the query-string, is the cause of the issue.  
I also tried the rewrite rules explained for proxying JIRA application. But they did not work as well.

Can someone please help me, setting the IIS' URL Rewrite rules properly, to simply proxy the Crowd instance? Following I have my rule attached.

Thank you very much in advance!

Sincerely

Kevin

++Inbound Rewrite Rule:++

```
<configuration>
??? <system.webServer>
??????? <rewrite>
??????????? <rules>
??????????????? <clear />
??????????????? <rule name="Crowd Proxy Rewrite Rule" enabled="true" stopProcessing="true">
??????????????????? <match url="(.*)" />
??????????????????? <action type="Rewrite" url="http://localhost:<CROWD-PORT>/crowd/{R:1}" />
??????????????? </rule>
??????????? </rules>
??????? </rewrite>
??????? <security>
??????????? <requestFiltering allowDoubleEscaping="true" />
??????? </security>
??? </system.webServer>
</configuration>
```


Answers:
author: Kevin Kirchhof
body: Additional information: My server is a Windows Server 2012 R2 and is running the Crwod instance on 64bit version of Tomcat.

On additionall yevaluation the stderr log, there are further errors, but I'm not sure if they relate to my issue above:

```
10-Mar-2018 22:40:00.053 WARNING [main] org.apache.catalina.core.AprLifecycleListener.init The APR based Apache Tomcat Native library failed to load. The error reported was [C:\Atlassian\CROWD\apache-tomcat\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform]
?java.lang.UnsatisfiedLinkError: C:\Atlassian\CROWD\apache-tomcat\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
?at java.lang.ClassLoader$NativeLibrary.load(Native Method)
?at java.lang.ClassLoader.loadLibrary0(Unknown Source)
?at java.lang.ClassLoader.loadLibrary(Unknown Source)
?at java.lang.Runtime.loadLibrary0(Unknown Source)
?at java.lang.System.loadLibrary(Unknown Source)
?at org.apache.tomcat.jni.Library.<init>(Library.java:42)
?at org.apache.tomcat.jni.Library.initialize(Library.java:178)
?at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:198)
?at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:129)
?at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
?at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:395)
?at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
?at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
?at org.apache.catalina.startup.Catalina.load(Catalina.java:630)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
?at java.lang.reflect.Method.invoke(Unknown Source)
?at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
?at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
```

(The binaries for the 64bit Tomcat were replaced in advance.)

and

```
11-Mar-2018 00:23:33.187 INFO [http-nio-8097-exec-12] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
?Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
?java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
?at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:422)
?at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:683)
?at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
?at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
?at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
?at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
?at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
?at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
?at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
?at java.lang.Thread.run(Unknown Source)
```

I hope someone knows this issue and can help me out of this trouble.

Thanks in advance,

Kevin


author: Kevin Kirchhof
body: Evaluation the catalina.log shows one error:

```
11-Mar-2018 00:23:33.187 INFO [http-nio-8097-exec-12] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
?Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
?java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
?at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:422)
?at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:683)
?at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
?at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
?at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
?at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
?at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
?at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
?at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
?at java.lang.Thread.run(Unknown Source)
```