Visit Our UNIX and Linux User Community

Rewrite proxypass

Thread Tools Search this Thread
Operating Systems Linux Rewrite proxypass
# 1  
Old 09-05-2013
Rewrite proxypass


I have a Apache 2.0 web server. When a users comes in to a check is applied if the path ends with *t*, the user hits a rewrite rule that adds an environment variable called x is hit with a proxypass. This has worked successfully in the past, but recently I added another rewrite rule that states if file is not found in document root then look at this path on the file system. If the file is in another path then the document root, the user is prompted with a 404 error. If I remove the proxy pass from the first rewrite rule that adds a variable then everything works fine. Does anyone know why this occurs? I know I can fix this issue by removing [P] from the rewrite rule, but what is explanation to this problem?

Previous Thread | Next Thread
Test Your Knowledge in Computers #565
Difficulty: Medium
The logical and operator is also called a conjunction.
True or False?

8 More Discussions You Might Find Interesting

1. Web Development

Rewrite wrong request

Hi everybody, In my web site I have several index pages in different languages in the following format days ago I noticed increased, many times. Google bot activity on my site and when I checked my log file I found that all pages crawled were wrong... (3 Replies)
Discussion started by: georgi58
3 Replies

2. UNIX for Advanced & Expert Users

Sendmail Rewrite Ruleset

Hi all, I like to write a rule which do the following: INPUT ADDRESS REWRITTEN TO ----------------------------- ----------------------------- ... (1 Reply)
Discussion started by: bashily
1 Replies

3. Shell Programming and Scripting

Efficient rewrite of code?

egrep -v "#" ${SERVERS} | while read shosts do grep -Pi "|" ${LOGFILE} | egrep "${snhosts}" | egrep "NOTIFICATION:" | awk -F";" '{print $3}' | sort -n | uniq | while read CEXIST do ... (6 Replies)
Discussion started by: SkySmart
6 Replies

4. Web Development

Need help with rewrite rule

Hi, I hosted my site on Apache web server. I wanted to redirect all the users request to a HTML page(maintenance page). I used the below rewrite rule to do ths same. RewriteEngine on RewriteRule .* /maintenance.html The maintenance.html page contains an image. When ever I try to... (2 Replies)
Discussion started by: BSrikanthB
2 Replies

5. UNIX for Dummies Questions & Answers

rewrite date

I'm looking to have function that takes the present month and rewrites it into this form: _06_ (june), _09_ (september), and so on.. I would like this to be a my $this_month=code that rewrites date function because I would like to be a able to call it multiple times in the script by writing... (5 Replies)
Discussion started by: marringi
5 Replies

6. Shell Programming and Scripting

grep help, how do i rewrite this

Thanks , franklin you method worked, i knew i had to use a while loop and getline in there just didnt know the proper order :) Hi everyone, im trying to make the following command line shorter by introducing a script that join up all the grep commands ./new1a < numbers.txt | grep -i -v '^a '... (5 Replies)
Discussion started by: weezybaby
5 Replies

7. Shell Programming and Scripting

How do I rewrite to use a while instead of find?

for FILE in `find /home/Upload/*` Need to use a while instead to prevent errors when the file is emptied (4 Replies)
Discussion started by: goodmis
4 Replies

8. UNIX for Advanced & Expert Users

Apache Rewrite help!

I am trying to write RewriteRule on Apache_1.3.26 to get users web page from another server. for example if users tries to get web page on it will get the web page from without redirect and users will not be aware of any redirect... (1 Reply)
Discussion started by: hassan2
1 Replies
DBILogger(3pm)						User Contributed Perl Documentation					    DBILogger(3pm)

Apache::DBILogger - Tracks what's being transferred in a DBI database SYNOPSIS
# Place this in your Apache's httpd.conf file PerlLogHandler Apache::DBILogger PerlSetVar DBILogger_data_source DBI:mysql:httpdlog PerlSetVar DBILogger_username httpduser PerlSetVar DBILogger_password secret PerlSetvar DBILogger_table requests Create a database with a table named requests like this: CREATE TABLE requests ( server varchar(127) DEFAULT '' NOT NULL, bytes mediumint(9) DEFAULT '0' NOT NULL, user varchar(15) DEFAULT '' NOT NULL, filename varchar(200) DEFAULT '' NOT NULL, remotehost varchar(150) DEFAULT '' NOT NULL, remoteip varchar(15) DEFAULT '' NOT NULL, status smallint(6) DEFAULT '0' NOT NULL, timeserved datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, contenttype varchar(50) DEFAULT '' NOT NULL, urlpath varchar(200) DEFAULT '' NOT NULL, referer varchar(250) DEFAULT '' NOT NULL, useragent varchar(250) DEFAULT '' NOT NULL, usertrack varchar(100) DEFAULT '' NOT NULL, KEY server_idx (server), KEY timeserved_idx (timeserved) ); Please note that for some databases (notably, PostgreSQL) you will need to double-quote the user column name (that is, to specify it as ""user" varchar(15)") in order for the database not to mistake it with a keyword. Its recommended that you include use Apache::DBI; use DBI; use Apache::DBILogger; in your script. Please read the Apache::DBI documentation for further information. DESCRIPTION
This module tracks what's being transfered by the Apache web server in a SQL database (everything with a DBI/DBD driver). This allows one to get statistics (of almost everything) without having to parse the log files (like the Apache::Traffic module, just in a "real" database, and with a lot more logged information). Apache::DBILogger will track the cookie from 'mod_usertrack' if it's there. After installation, follow the instructions in the synopsis and restart the server. The statistics are then available in the database. See the section VIEWING STATISTICS for more details. PREREQUISITES
You need to have compiled mod_perl with the LogHandler hook in order to use this module. Additionally, the following modules are required: o DBI o Date::Format INSTALLATION
To install this module, move into the directory where this file is located and type the following: perl Makefile.PL make make test make install This will install the module into the Perl library directory. Once installed, you will need to modify your web server's configuration file so it knows to use Apache::DBILogger during the logging phase. VIEWING STATISTICS
Please see the bin/ directory in the distribution for a statistics script. Some funny examples on what you can do might include: hit count and total bytes transfered from the virtual server select count(id),sum(bytes) from requests where server="" hit count and total bytes from all servers, ordered by number of hits select server,count(id) as hits,sum(bytes) from requests group by server order by hits desc count of hits from macintosh users select count(id) from requests where useragent like "%Mac%" hits and total bytes in the last 30 days select count(id),sum(bytes) from requests where server="" and TO_DAYS(NOW()) - TO_DAYS(timeserved) <= 30 This is pretty unoptimal. It would be faster to calculate the dates in perl and write them in the sql query using f.x. Date::Format. hits and total bytes from on mondays. select count(id),sum(bytes) from requests where server="" and dayofweek(timeserved) = 2 It's often pretty interesting to view the referer info too. See your sql server documentation of more examples. I'm a happy mySQL user, so I would continue on LOCKING ISSUES
MySQL 'read locks' the table when you do a select. On a big table (like a large httpdlog) this might take a while, where your httpds can't insert new logentries, which will make them 'hang' until the select is done. One way to work around this is to create another table (f.x. requests_insert) and get the httpd's to insert to this table. Then run a script from crontab once in a while which does something like this: LOCK TABLES requests WRITE, requests_insert WRITE insert into requests select * from requests_insert delete from requests_insert UNLOCK TABLES You can use the script from the bin/ directory. Please note that this won't work if you have any unique id field! You'll get duplicates and your new rows won't be inserted, just deleted. Be careful. TRAPS
I've experienced problems with 'Packets too large' when using Apache::DBI, mysql and DBD::mysql 2.00 (from the Msql-mysql 1.18x packages). The DBD::mysql module from Msql-mysql 1.19_17 seems to work fine with Apache::DBI. You might get problems with Apache 1.2.x. (Not supporting post_connection?) MOD_PERL 2 SUPPORT The official version of this module, as Ask Bjoern Hansen last modified it, lacks support for the API changes introduced with Apache 2.x and the corresponding mod_perl 2.x - Of course, this is quite understandable as this module was last updated in 1998 ;-) But anyway, the module does its job still quite fine, and users still require its functionality. For any help requests regarding this module on Apache 2 systems, contact Gunnar Wolf <> directly. If your system is based on Debian GNU/Linux, you can use the regular Debian bugtracking facilities, as the multi-API patch was introduced specifically for Debian. SUPPORT
This module is supported via the mod_perl mailinglist (, subscribe by sending a mail to I would like to know which databases this module have been tested on, so please mail me if you try it. The latest version can be found on your local CPAN mirror or at "" AUTHOR
Copyright (C) 1998, Ask Bjoern Hansen <>. All rights reserved. This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1), mod_perl(3) perl v5.12.3 2011-06-16 DBILogger(3pm)

Featured Tech Videos