Project

General

Profile

Actions

Feature #614

closed

mod_mysql_rewrite

Added by zobo almost 19 years ago. Updated over 8 years ago.

Status:
Wontfix
Priority:
Normal
Category:
3rd party
Target version:
-
ASK QUESTIONS IN Forums:

Description

Hi all.
The thing that was missing in lighttpd for us, was the ability to get rewrite rules from a mysql database. Yes I could write a cron script that dumps a table into a configure file and reloads lighty, but this is much more fun q:)

New config vars were basically copied from mod_mysql_vhost


mysql-rewrite.db = "test" 
mysql-rewrite.user = "dbuser" 
mysql-rewrite.pass = "dbpass" 
#mysql-rewrite.sock = "" 
mysql-rewrite.hostname = "dhbost.local.net" 
#mysql-rewrite.port = 0
mysql-rewrite.sql = "select rw_src, rw_dst, rw_once from rewrite" 

The SQL query has to return 3 cols, rather self explanatory.

Also note, that lighty reloads the rewrite rules every 300 seconds (hard coded for now), but does not erase the old ones if the query fails for some reason.

I quick tested the implementation for memory leaks.

-Z

PS: Maybe it would be better to just join mod_rewrite and mod_mysql_rewrite, because most of the code is duplicated.
PPS: For the most part of the mod_rewrite, I have no clue what it does, so I accept the fact that there will be some laughs at my expense..


Files

Actions #1

Updated by gstrauss over 8 years ago

  • Description updated (diff)
  • Category changed from mod_rewrite to 3rd party
Actions #2

Updated by gstrauss over 8 years ago

  • Status changed from New to Wontfix
  • Assignee deleted (jan)

Interesting idea to be able to dynamically reconfigure the rewrite rules by refreshing from a MySQL database every 5 mins.

It would probably be better to restart lighttpd to pick up changes as they occur, and if changes are occurring so frequently that the rules are changing less than every 5 minutes or some other relatively short frequency, then a solution already available in lighttpd is to use mod_magnet and to write your rewrite rules in lua. Using mod_magnet, the lua code will be reloaded when the target file containing the lua code changes.

Actions

Also available in: Atom