Project

General

Profile

I get 403 error when accessing files in alias repository

Added by badre almost 12 years ago

I have a lighthttpd server in front of a tomcat web server. Tomcat has 2 webapps : portal and dolo. I configured lighthttpd to redirect requests for www.domain1.com to /portal and requests for www.domain2.com to /dolo.
lighthttpd config file :

$HTTP["host"] =~ "^(www.)?domain1.ma" {
  alias.url = (
    "/images/" => "/collecte/images/",
    "/statics/"      => "/collecte/statics/",
  )
  url.rewrite-final = ("^/images/(.*)$" => "/images/$1", "^/statics/(.*)$" => "/statics/$1" ,  "^/(.*)" => "/portal/$1" )
  $HTTP["url"] !~ "^(/statics/|/images/)" {
  proxy.server = ( "" =>
    ( "tomcat" =>
      (
        "host" => "127.0.0.1",
        "port" => 9090,
        "fix-redirects" => 1
        )
      )
    )
  }
}

$HTTP["host"] =~ "^(www.)?domain2.com" {
  alias.url = (
    "/images_deal/" => "/deal/images/",
    "/statics_deal/"      => "/deal/statics/",
  )
  url.rewrite-final = ("^/images_deal/(.*)$" => "/images_deal/$1", "^/statics_deal/(.*)$" => "/statics_deal/$1" ,  "^/(.*)" => "/dolo/$1" )
  $HTTP["url"] !~ "^(/statics_deal/|/images_deal/)" {
    proxy.server = ( "" =>
     ( "tomcat" =>
      (
        "host" => "127.0.0.1",
        "port" => 9090,
        "fix-redirects" => 1
      )
      )
    )
  }
}

Accessing domain1.com and domain2.com works fine, but when I tried to access images from my alias /images or css files from /statics, I get 403 error.
I tried also to make chmod 777 to statics folders, and to replace lighttpd user by root but I got the same error.

I am using Gentoo Base System version 1.6.14
$Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.3 2005/09/01 14:22:35 ka0ttic Exp

activate modules are

server.modules = (
    "mod_rewrite",
#    "mod_redirect",
    "mod_alias",
    "mod_access",
#    "mod_cml",
#    "mod_trigger_b4_dl",
#    "mod_auth",
#    "mod_status",
#    "mod_setenv",
    "mod_proxy",
#    "mod_simple_vhost",
    "mod_evhost",
#    "mod_userdir",
#    "mod_compress",
#    "mod_ssi",
#    "mod_usertrack",
#    "mod_expire",
#    "mod_secdownload",
#    "mod_rrdtool",
#    "mod_webdav",
    "mod_accesslog" 
)


Replies (1)

RE: I get 403 error when accessing files in alias repository - Added by carpii almost 12 years ago

Forget about domain2, and forget about domain1/statics for now
Just get domain1/images working first...

Maybe Im missing something, but what is the purpose of your mod-rewrite from "^/images/(.*)$" => "/images/$1" ?

What version of lighty are you using?

What is in lightys error log and also tomcat error log for a given request to /images/* ?

    (1-1/1)