68382

Change QUERYSTRING with the lighttpd proxy

Question:

First of all sorry for my English, hope you can undestand it.

I need to change the URL of the destination server with Lighttpd, I mean, someone is going to write an URL like <a href="http://my.proxy.server.com/MYQUERY" rel="nofollow">http://my.proxy.server.com/MYQUERY</a> and I need to change it to something like <a href="http://XXX.XXX.XXX.XXX/search?q=MYQUERY" rel="nofollow">http://XXX.XXX.XXX.XXX/search?q=MYQUERY</a>.

I tried to add an "querystring" option like the configuration below but it didn't work.

proxy.server = ( "" => ( ( "host" => "XXX.XXX.XXX.XXX", "port" => 80, "querystring" => "/search?q=$HTTP[querystring]" ) ) )

I also tried to force changing the URL with the code below but it didn't work neither.

$HTTP["url"] =~ "^/"{ server.querystring = "/search/q=$HTTP[querystring]" }

What can I do? Does lighttpd have this feature?

thanks

Answer1:

Found it. First of all I need to have the mod_rewrite activated, then before the proxy configuration I just need to rewrite the url, like:

url.rewrite-once = ( "/(.*)" => "/search?q=$1" )

Thank you all.

Recommend

  • mysql_connection problems — 'getaddrinfo failed', “No such host is known”?
  • How To Execute MS Access Query with OLEDB.12
  • SQL min values from two columns across two tables against ID
  • How to (.htaccess) rewrite the url of a specific search query?
  • How to use client.query without JSX components in Apollo Client?
  • How to calculate CRC of a WinRAR file?
  • Read PHP Session data in node.js
  • PHP: black image when cropping using php
  • How to add new collection criteria in Plone 5?
  • Process.StartTime Access Denied
  • Getting JavaScript runtime error: irrationalPath, what does it mean?
  • Simple Injector fails if using verify before setting dependency resolver for MVC 4
  • proxy request in node.js / express
  • Deployments not visible in Kubernetes Dashboard
  • Want to save selected (i.e., more than 1) enums as string with NHibernate
  • Send emails through VB6 if no email client
  • How to convert integer to string and get length of string
  • Bad interaction between Zope2 XML-RPC and AT Image mutator?
  • Blackberry 6: how to detect a long click on track pad?
  • How to pass nginx proxy url for socket
  • Google Custom Search with transparent background
  • Email format validation in mvc3 view
  • Insert into database using onclick function
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • What is Eclipse's Declaration View used for?
  • How to add date and time under each post in guestbook in google app engine
  • Can I make an Android app that runs a web view in Chrome 39?
  • Calling of Constructors in a Java
  • Traverse Array and Display in markup
  • bootstrap to use multiple ng-app
  • Transpose CSV data with awk (pivot transformation)
  • How to get icons for entities from eclipse?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Angular 2 constructor injection vs direct access
  • coudnt use logback because of log4j
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • UserPrincipal.Current returns apppool on IIS