The question is how to get IIS to proxy a webapp with both static data and webservices.
I made a cherrypy app to search in a large number of images for specific tags. With cherrypy, the dynamic functionality is served with dispatching, as sketched below for the find service:
config = { '/' : { 'tools.staticdir.on' : True,
'tools.staticdir.root' : <root>,
'tools.staticdir.dir' : <dir> },
{ '/find' : { 'request.dispatch' : cherrypy.dispatch.MethodDispatcher(),
'tools.response_headers.on' : True,
'tools.response_headers.headers' : [('Content-Type', 'text/plain') ]}}
This works using cherrypy as server, say on //127.0.0.1:1414
I was able to serve my cherrypy app to /myapp with Apache2 if I proxy every service of my app.
<VirtualHost *:80>
# static stuff
ProxyPass /myapp http://127.0.0.1:1414
ProxyPassReverse /myapp http://127.0.0.1:1414
# service stuff
ProxyPass /find http://127.0.0.1:1414/find
ProxyPassReverse /find http://127.0.0.1:1414/find
</VirtualHost>
So far so good, but on the windows server that should host this, there is an IIS app-server. This has the usual windows interface with many buttons and cascading 'more or less advanced settings'.
- enabled proxy on the 'application request routing page'
- created a reverse proxy rule (urlrewrite)
The rule as created maps myhost/myapp with pattern (.*) with rewrite to //127.0.0.1:1414/{R:1}. There is a web.conf that says:
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://127.0.0.1:1414/{R:1}" />
</rule>
This works for the static part. It does not work for the services; I get a 500 for that. Whatever I change on the pattern seems to make no difference: static is ok, services not. Any hint ?
Aucun commentaire:
Enregistrer un commentaire