IIS 8.5 static file using rewrite problem

721 views
Skip to first unread message

Remco Boerma

unread,
Aug 12, 2015, 4:01:45 PM8/12/15
to web2py-users
Hi, 

I'm migrating from ubuntu to windows 2012R2 + IIS 8.5. 

Following a slightly altered recipe from the book to install web2py under IIS (but mostly the same) i've come across a strange error. Since i'm not accustomed to IIS, it can well be my issue is standard IIS-knowledge-gap related. I have installed the rules module, have web2py up and running. Now i installed another app inside web2py that worked before on a 2.11.2 on my local windows machine as well as on a 2.9.5 server behind apache and all of a sudden my static files are 401'd 

I don't use any special static versioning. When i disabled the static rewrite rule everything works like a charm. My setup is as simple as possible (only web2py in the root) running 2.12.2 stable on ii 8.5 python 2.7.9. 

the static rule in web.config (comes from the sample) is: 

<rule name="static" enabled="false" stopProcessing="true"> <match url="^(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="applications/{R:1}/static/{R:2}" logRewrittenUrl="false" /> </rule>

Does anyone have any clue why i have those 401s? 


With kind regards, 
Remco Boerma


Niphlod

unread,
Aug 13, 2015, 1:03:34 PM8/13/15
to web2py-users
401 means not authorized. What happens without rewrite (or incorrect ones) is usually 404 (not found) . 
Can you post more details about the structure of the iis site which the app belongs ?

Remco Boerma

unread,
Aug 18, 2015, 8:07:21 AM8/18/15
to web...@googlegroups.com
Solved. 

While gathering information about my setup I found the solution. 

Setting "Default web site > Authentication > Anonymous Authentication (keep enabled) " to "Application Pool Identity" solved my issue. 



Here's a few tags and keywords for future reference when someone else bumps into this: 

In IIS i have one site, which is the default web site. It's stored at c:/inetpub/wwwroot. This is where the web2py zip file contents went, so there is an applications folder, examples, gluon, jada jada. URL rewrite is used like in the example given in the web2py book. 
When the static rewrite rule is enabled and setting "error pages > Edit feature settings> Detailed errors" I  get the following error when requesting http://wvwebt01/welcome/static/css/calendar.css:


HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

Detailed Error Information:
Module   IIS Web Core
Notification   AuthenticateRequest
Handler   StaticFile
Error Code   0x80070005
Physical Path   C:\inetpub\wwwroot\applications\welcome\static\css\calendar.css
Logon Method   Anonymous
Logon User   Anonymous

Looking at http://stackoverflow.com/a/10457630 i changed "iis manager> default web site > authentication > Anonymous Authentication > Edit... " to "Application pool identity" instead of "specific user: IUSR" (which is the default). Since this user is not given any direct access on the files, but following the books recipe the  application pool group is. (http://www.web2py.com/books/default/chapter/29/13/deployment-recipes#IIS

Thanks anyway Niphlod!

Op donderdag 13 augustus 2015 15:03:34 UTC+2 schreef Niphlod:

Niphlod

unread,
Aug 18, 2015, 8:43:55 AM8/18/15
to web2py-users
didn't quite get if it's an error on the recipe (which I can't replicate, since it's my standard tried several times setup) or your "slightly changed recipe" was the cause of the error.

Remco Boerma

unread,
Aug 18, 2015, 9:31:04 AM8/18/15
to web2py-users
I've uploaded a video demonstrating the installation I did which works quite well. it's far from perfect as a video and demonstration, but all the tinkering is in there, i think it matches your setup quite well.  

https://www.youtube.com/watch?v=gxOhsThD0FY 

Op dinsdag 18 augustus 2015 10:43:55 UTC+2 schreef Niphlod:

Dmitri Ermolaev

unread,
Aug 18, 2015, 8:07:15 PM8/18/15
to web...@googlegroups.com
how you start web2py under IIS ?????

2015-08-18 11:07 GMT+03:00 Remco Boerma <remco....@gmail.com>:
Solved. 

While gathering information about my setup I found the solution. 

Setting "Default web site > Authentication > Anonymous Authentication (keep enabled) " to "Application Pool Identity" solved my issue. 



Here's a few tags and keywords for future reference when someone else bumps into this: 

In IIS i have one site, which is the default web site. Below It's stored at c:/inetpub/wwwroot. This is where the web2py zip file contents went, so there is an applications folder, examples, gluon, jada jada. URL rewrite is used like in the example given in the web2py book. 
When the static rewrite rule is enabled and setting "error pages > Edit feature settings> Detailed errors" I  get the following error when requesting http://wvwebt01/welcome/static/css/calendar.css:


HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

Detailed Error Information:
Module   IIS Web Core
Notification   AuthenticateRequest
Handler   StaticFile
Error Code   0x80070005
Physical Path   C:\inetpub\wwwroot\applications\welcome\static\css\calendar.css
Logon Method   Anonymous
Logon User   Anonymous

Looking at http://stackoverflow.com/a/10457630 i changed "iis manager> default web site > authentication > Anonymous Authentication > Edit... > Application pool identity" instead of specific user IUSR (default), which is not given any direct access on the files, but according to the book the application pool group is. 

Thanks Niphlod!

Op donderdag 13 augustus 2015 15:03:34 UTC+2 schreef Niphlod:
401 means not authorized. What happens without rewrite (or incorrect ones) is usually 404 (not found) . 
Can you post more details about the structure of the iis site which the app belongs ?

On Wednesday, August 12, 2015 at 6:01:45 PM UTC+2, Remco Boerma wrote:
Hi, 

I'm migrating from ubuntu to windows 2012R2 + IIS 8.5. 

Following a slightly altered recipe from the book to install web2py under IIS (but mostly the same) i've come across a strange error. Since i'm not accustomed to IIS, it can well be my issue is standard IIS-knowledge-gap related. I have installed the rules module, have web2py up and running. Now i installed another app inside web2py that worked before on a 2.11.2 on my local windows machine as well as on a 2.9.5 server behind apache and all of a sudden my static files are 401'd 

I don't use any special static versioning. When i disabled the static rewrite rule everything works like a charm. My setup is as simple as possible (only web2py in the root) running 2.12.2 stable on ii 8.5 python 2.7.9. 

the static rule in web.config (comes from the sample) is: 

<rule name="static" enabled="false" stopProcessing="true"> <match url="^(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="applications/{R:1}/static/{R:2}" logRewrittenUrl="false" /> </rule>

Does anyone have any clue why i have those 401s? 


With kind regards, 
Remco Boerma


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niphlod

unread,
Aug 19, 2015, 6:32:39 AM8/19/15
to web2py-users
Reply all
Reply to author
Forward
0 new messages