Author Topic: ifuser not working with mod_rewrite ?  (Read 905 times)

Offline lbm_

  • New user
  • *
  • Posts: 23
    • View Profile
ifuser not working with mod_rewrite ?
« on: January 28, 2016, 09:05:33 am »
I have the following directive inside my config, and if I comment the ifUser statements to disable it, the mod_rewrite is working fine, but with this statement below or with <ifuser !test> the mod_rewrite is not working anymore.
I can read here http://www.proftpd.org/docs/contrib/mod_ifsession.html that some directives is not supported inside ifuser statements, and I wounder if this is the same I ran into?

Code: [Select]
<IfUser test>
 <IfModule mod_rewrite.c>
   RewriteEngine on
   # Define a map that uses the internal "tolower" function
   RewriteMap lowercase int:tolower
   # Rewrite all commands except PASS
   RewriteCondition %m STOR
   RewriteRule ^(.*) ${lowercase:$1}
 </IfModule>
</IfUser>

Offline lbm_

  • New user
  • *
  • Posts: 23
    • View Profile
Re: ifuser not working with mod_rewrite ?
« Reply #1 on: January 28, 2016, 09:43:46 am »
The debug logs gives me this, when uploading an file with the test user, but the file is not rewritten, which to me looks like the mod_rewrite is loaded correctly, but rules are not applied.. ?

Code: [Select]
(localhost.localdomain[127.0.0.1]): dispatching PRE_CMD command 'STOR TesT.txt' to mod_rewrite
(localhost.localdomain[127.0.0.1]): dispatching PRE_CMD command 'STOR TesT.txt' to mod_tls
(localhost.localdomain[127.0.0.1]): dispatching PRE_CMD command 'STOR TesT.txt' to mod_core
(localhost.localdomain[127.0.0.1]): dispatching PRE_CMD command 'STOR TesT.txt' to mod_core
(localhost.localdomain[127.0.0.1]): dispatching PRE_CMD command 'STOR TesT.txt' to mod_xfer
(localhost.localdomain[127.0.0.1]): in dir_check(): setting umask to 0002 (was 0002)
(localhost.localdomain[127.0.0.1]): dispatching CMD command 'STOR TesT.txt' to mod_xfer
(localhost.localdomain[127.0.0.1]): passive data connection opened - local  : 127.0.0.1:50795
(localhost.localdomain[127.0.0.1]): passive data connection opened - remote : 127.0.0.1:50794
(localhost.localdomain[127.0.0.1]): dispatching LOG_CMD command 'STOR TesT.txt' to mod_log
(localhost.localdomain[127.0.0.1]): dispatching LOG_CMD command 'STOR TesT.txt' to mod_xfer
(localhost.localdomain[127.0.0.1]): Transfer completed: 0 bytes in 0.00 seconds

Offline lbm_

  • New user
  • *
  • Posts: 23
    • View Profile
Re: ifuser not working with mod_rewrite ?
« Reply #2 on: January 28, 2016, 10:03:25 am »
FIXED...
by moving the configuration around a little. The "RewriteEngine on" must be loaded outside the ifuser scope, like this.

<IfModule mod_rewrite.c>
 RewriteEngine on
 <IfUser !test>
   # Define a map that uses the internal "tolower" function
   RewriteMap lowercase int:tolower
   # Rewrite all commands except PASS
   RewriteCondition %m STOR
   RewriteRule ^(.*) ${lowercase:$1}
 </IfUser>
</IfModule>