#899 Redirect not working

current actionsfile
closed-works-for-me
Fabian Keil
5
2013-05-14
2013-05-13
James
No

Hi, I'm trying to set up a redirect using privoxy, but am having issues with the regular expression andwondered if anyone could point me in the right direction.

I'm trying to redirect http://www.example.com/webextend/smssend.asp?smsto=00000000000&message=message to https://192.168.212.205/sendsms.php?

I cant get the $_GET info to pass to the new URL. I'm using the following action:

{-fast-redirects \ +redirect{s@^http://[^/]*smssend\.asp\?([^&]*).*@https://192.168.212.205/sendsms.php?$1@}}
.example.com/(.*/)smssend.asp

Where am I going wrong? Can anyone help me?

James

Discussion

  • Fabian Keil
    Fabian Keil
    2013-05-14

    Your redirect{} pcrs command doesn't allow slashes between "http://" and "smssend" and thus the request isn't redirected.

    You could try something like:

    {+redirect{s@^http://.*smssend\.asp\?@https://192.168.212.205/sendsms.php?@}}
    .example.com/.*/smssend.asp

    (I'm assuming everything after the "?" should be kept.)

     
  • Fabian Keil
    Fabian Keil
    2013-05-14

    • assigned_to: nobody --> fabiankeil
    • status: open --> pending
     
  • James
    James
    2013-05-14

    I made the change to the code you suggested, but it still doesn't redirect. I have pasted the forwarding settings and final result of the show-url-info below

    Forwarding settings:

    Requests for http://update.example.com/support/webextend/smssend.asp?test will be made directly, no forwarding settings apply.

    Final results:

    +change-x-forwarded-for{block}
    +client-header-tagger{css-requests}
    +client-header-tagger{image-requests}
    +hide-from-header{block}
    +redirect{s@^http://.*smssend\.asp\?@https://192.168.212.205/sendsms.php?@}
    +set-image-blocker{pattern}

    -add-header
    -block
    -client-header-filter
    -content-type-overwrite
    -crunch-client-header
    -crunch-if-none-match
    -crunch-incoming-cookies
    -crunch-outgoing-cookies
    -crunch-server-header
    -deanimate-gifs
    -downgrade-http-version
    -fast-redirects
    -filter
    -force-text-mode
    -forward-override
    -handle-as-empty-document
    -handle-as-image
    -hide-accept-language
    -hide-content-disposition
    -hide-if-modified-since
    -hide-referrer
    -hide-user-agent
    -limit-connect
    -limit-cookie-lifetime
    -overwrite-last-modified
    -prevent-compression
    -server-header-filter
    -server-header-tagger
    -session-cookies-only

     
  • James
    James
    2013-05-14

    Thank you Fabiankeil for your assistance, I do wish to retain everything after the ?

     
  • James
    James
    2013-05-14

    Ah sorry, I made a typo. All working fine now thank you

     
  • Fabian Keil
    Fabian Keil
    2013-05-14

    You're welcome. Thanks for reporting back that it's working now.

     
  • Fabian Keil
    Fabian Keil
    2013-05-14

    • status: pending --> closed-works-for-me
     
  • James
    James
    2013-05-14

    Bit premature. Still a small issue. The script on the webpage isn't working, I believe its because the URL is not properly formed. Below is part of the webserver log, which shows a missing ? after the sendsms.php and before smsto. Any ideas?

    /sendsms.php smsto=07794661474&smstext=test