[Solved] url.rewrite-once in case of port forwarding
I'm quite new with lighttpd.
I'm using it in a board using an ARM microprocessor with Debian on board.
I'heve developed a web app using the fat free framework and it works fine inside my local network.
I'm now tring to make the web app accessible from outside the local network.
So I have a port forwarding on the router to give access to the web server inside my local network.
So now the web server is accessible from to outside to the address xxx.vfdns.org:7777
The problem is that when I perform a "reroute" to the /login route from my webapp the web app routes to the (wrong) url xxx.vfdns.org/login and not to the (right) url xxx.vfdns.org:7777/login.
This of course result in URL not found. If I add manually the port(7777) the url is ok.
The question is how modify the url.rewrite-once rule to add always the port 7777 (is not already present) when accessing the url xxx.vfdns.org?
The actual lighttpd.conf is:
The versione of lighttpd is lighttpd/1.4.53 (ssl) - a light and fast webserver
Thanks in advance.
please could give an example of the rule I should use to redirect the pages on the right port? Of course the port is not fixed but is a parameter defined by the router port mapping rule (in this case the ruoter maps the external port 7777 on the internal standard 80). Thansk a lot.
your webapp should look in the environment and use SERVER_PORT when constructing the route it sends back to the client.
[Edit] if your firewall is doing the port mapping, lighttpd does not know that the client used port :xxx; lighttpd only knows the port(s) on which lighttpd is listening, and provides that information to CGI, FastCGI, SCGI, etc in
SERVER_PORT. If your app sends a response with a link, your app needs to either use a url-path (
/login) or your app needs to produce the correct fully-qualified URL (
The point is that SERVER_PORT contains the port 80 and not the port 7777 seen from outside the router. So it seems to me that the webapp can't build the URL you mention because I don't know where to recover the external port number (7777). For sure I doing something wrong but I don't know hwre the problem is.