Project

General

Profile

Can't serve different directories on different port, always get status 401

Added by renanro over 4 years ago

I'm trying to serve two applications on different ports and for that I'm using the $SERVER["socket"] variable, as seen in the example bellow.

# webpage root (running on port 80)
server.document-root = "/var/www" 

# api root
$SERVER["socket"] == ":3000"{                                              
        server.document-root = "/var/www/api"             
        url.rewrite = ("^/api/.*" => "index.php")
}

I have an API running on Slim framework on this port, but when I try to make a request it always return an empty response with the status code 401 Unauthorized.

I tried other directory configurations (like /var/www/web and /var/www/api) but the error persists. I'm using lighttpd version 1.4.45.


Replies (2)

RE: Can't serve different directories on different port, always get status 401 - Added by gstrauss over 4 years ago

I have an API running on Slim framework on this port, but when I try to make a request it always return an empty response with the status code 401 Unauthorized.

Please review the documentation for the Slim framework.

The config snippet you have posted above is just that, a snippet, and not relevant to the problem you are having.

RE: Can't serve different directories on different port, always get status 401 - Added by renanro over 4 years ago

Ok, I'll try that, it just didn't occuur to me that the problem might be related to Slim, since the API was working when served on the same port as the page.

    (1-2/2)