2

Versions:

  • Windows Server 2008 R2 SP1
  • TeamCity 7.0.2
  • Tomcat 7.0.27
  • IIS 7.5
  • ARR 2.5
  • URL ReWrite 7.2.2

TeamCity is installed into a pre-existing TomCat installation as a JavaEE WAR. IIS has been successfully setup to reverse proxy calls for TeamCity. My rewrite rule is below:

<rule name="TeamCity Redirect" stopProcessing="true">
    <match url="^(TeamCity.*)" />
    <action type="Rewrite" url="http://localhost:8080/{R:1}" logRewrittenUrl="true" />
</rule>

I have no problem logging into TeamCity from a remote host and using/administering it. However, when I enable the built-in NuGet server, I encounter a frustrating issue.

Trying to access the nuget feed from any remote host proxying through IIS gives me an HTTP 404 error. The 404 error comes from IIS. When I remove the final path part from the url, the 404 error comes from Tomcat.

Example:

So, somewhere I am having issues with IIS respecting a redirect with *.svc files, but for the life of me, I cannot figure out why, or where this is set.

Any help is greatly appreciated.

2 Answers 2

1

Ah, the power of posting. After asking the question, I decided to take a look at the rules I had setup one more time.

The rules were setup on the site level. I moved them to the server level, and everything works like a charm.

1
  • Adding the rule at server level definitively solved the problem. Aug 8, 2012 at 18:10
1

Seems you do not need any rewrite rules. Check TeamCity server context path is the same as in your public server, i.e. http://public.com/contextPath and http://localhost:8080/contextPath.

TeamCity uses request URI to generate NuGet feed, so you should make sure your proxy provides HOST, X-Forwarded-Host, X-Forwarded-Server, X-Forwarded-For headers. You may enable/check tomcat's access log to see what requests comes from IIS to TeamCity.

Please also take a look at the installation guide at http://blog.endjin.com/2010/11/a-step-by-step-guide-to-hosting-teamcity-in-iis-7/

If this does not work, please attach server logs to [email protected]

2
  • That definitely resolves the server url issue. Apr 26, 2012 at 23:01
  • How do you ensure IIS adds the X-Forwarded.... headers? My NuGet feeds (from Octopus Deploy) are not working, and I am wondering if this is the reason? Feb 20, 2017 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .