Forum Moderators: phranque

Message Too Old, No Replies

Suffix Map configurations for Apache.

Need Help Setting Handlers for Web Pages Suffixes.

         

rescueme

6:19 pm on Jan 12, 2009 (gmt 0)

10+ Year Member



I am new to Apache and need help getting a new web server up and running. The server is for a new international animal rescue network. The website is getting about 10,000 page views per day, and I want to make sure I have everything setup properly.

First off, we use a CGI program called "NetCloakEnabler" to handle most of our pages. Someone gave me the following line to add to our httpd.conf file:

FastCgiExternalServer /Library/Tenon/WebServer/WebSites/* -re -host localhost:9008 -pass-header Authorization

The above line, successfully passes all web page requests to the NetCloakEnabler program, which is indeed what I wanted. The "trick" here is that I didn't want to just pass pages ending with a certain suffix (such as, say .nclk) but instead also wanted pages without any suffix at all to be handled by this CGI as well, which is why the * has no suffix at all after it.

For example, the NetCloak Enabler not only handles: www.SomeSite.com/webpage.nclk

It ALSO must handle web pages like this: www.SomeSite.com/webpage
(in the case above, "webpage" is not a directory, it itself is a page)

Well, the line shown above does work, HOWEVER, that line causes EVERYTHING to go to NetCloak, including graphics. I DON'T want some files going to NetCloak such as: .jpg, .gif, .ico, .txt, ETC.

At this point, while I can program web pages, javascript, etc., I know nothing about Unix or Apache, so all I can do is basically COPY/PASTE what people suggest. If you can offer any hints about how I can change this line (or add additional lines) so that only certain pages are sent to NetCloak, please let me know what to do:

FastCgiExternalServer /Library/Tenon/WebServer/WebSites/* -re -host localhost:9008 -pass-header Authorization

I know how to modify this so only certain suffixes are sent, the trick I need help with is to allow only certain suffixes, but not others, while ALSO allowing pages without any suffix at all to go to NetCloak.

Any ideas? Thank you.

Caterham

1:07 am on Jan 13, 2009 (gmt 0)

10+ Year Member



Make use of a regular expression you specified with -re

If your path does not contain any additional periods, you could use a positive list like

/Library/Tenon/WebServer/WebSites/(?>[^.]*)(?:\.(?:nclk¦bar))?$

otherwise a negative lookbehind.

/Library/Tenon/WebServer/WebSites/.*(?<!\.(?:jpg¦gif))$

The PCRE manpage [perldoc.perl.org] has details about the syntax.

Replace ¦ with solid ones from your keyboard.

rescueme

1:33 am on Jan 13, 2009 (gmt 0)

10+ Year Member



Thanks, Caterham. Your suggestion worked perfectly, and I was able to implement it in seconds.

Thanks for the link to the syntax for Perl expressions page.

I've used GREP patterns before, so I should be able to learn Perl easily enough from this page.