1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with redirecting requests

Discussion in 'General Programming Chat' started by phatzilla, Feb 8, 2013.

  1. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    Heres the quick scoop:

    - My programmer is on vacation and i dont have source code to his application.

    - His program requests a certain url and parses its response, lets call it https://abc.com/123.js

    - Recently, https://abc.com/123.js has been taken down and the required information has been moved to https://abc.com/1234.js

    - So now, i need to be hitting the new file, would it be possible to systematically route all requests from https://abc.com/123.js --> https://abc.com/1234.js ?


    As far as im aware, editing the hosts file wont be able to solve this conundrum, i tried some WAMP server fuckery, but was unsucessful as i didn't want to go through the trouble of setting up ssl certs and all that stuff, as this is a https request.

    Help would be greatly appreciated.
     
    Last edited: Feb 8, 2013
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,148
    You need to edit your hosts file to point the abc.com domain on localhost and set up wamp to serve it (or you could host it on another https site you own and modify the hosts file accordingly)
     
  3. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    The problem with the hosts/wamp setup is that setting up ssl on wamp is such a PITA. And i dont own any dedicated hosting with a cert.

    :( are these my only options
     
  4. hatemachine

    hatemachine Regular Member

    Joined:
    Jan 14, 2011
    Messages:
    271
    Likes Received:
    1,138
    What's the application written in? What could be done is to build an extension using Fiddler.

    http://www.fiddler2.com/Fiddler/dev/

    Then you could act proxy, catch the request, redirect to new url and return back to your app.
     
  5. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    the problem with using fiddler is that the application uses proxied requests to https://abc.com/123.js, so it wont really work with fiddler iirc. Plus, fiddler really doesn't play well with ssl requests coming from an application (or the application doesn't play well with fiddler i should say), as the certificate isn't trusted or whatever. Im guessing the hosts file along with wamp/your own server is the only option, arg.
     
    Last edited: Feb 9, 2013
  6. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    Okay a bit of an update:

    Got wamp server working with https connections (was a bitch), now the hosts file / wamp server are doing their thing when the bot makes a request to https://abc.com/123.js it gets redirected properly to https://abc.com/1234.js. However, when attempting to use proxies with the bot, it doesn't work (same issues as previously). So does the hosts file not account for proxied requests?

    I tried using a localhost proxy 127.0.0.1:8888 alongside fiddler, and it also worked. But when i use external http proxies, it seemingly still hits the old url, as if the hosts file isn't rerouting it.

    My guess is its because the proxy is still making the request to https://abc.com/123.js , get's 404'd, and im back to square one, i guess the request gets routed through the proxy before it's looked up in the Hosts file. LAME
     
    Last edited: Feb 9, 2013
  7. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,148
    If the program is routing the dns requests via the proxies, yes, the proxies do not get affected by the hosts settings (they are on different machines).
     
  8. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    Welp, learn something new everyday i guess.
     
  9. jakab

    jakab Newbie

    Joined:
    Feb 11, 2013
    Messages:
    1
    Likes Received:
    0
    I agree with you if there is any problem in DNS than you can do if with proxy site. There is not any effect when you do it with proxy site.
     
  10. theMagicNumber

    theMagicNumber Regular Member

    Joined:
    May 13, 2010
    Messages:
    345
    Likes Received:
    195
  11. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    Cheers


    Didn't get lucky though ;(
     
  12. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,884
    Likes Received:
    1,932
    Try disassembling the code? There is a free trial of .NET Reflector available that will return the code to readable source code / alternatively find a freelancer that will disassemble the code if encrypted?
     
  13. phatzilla

    phatzilla Supreme Member

    Joined:
    Apr 9, 2009
    Messages:
    1,366
    Likes Received:
    1,017
    It's written in Delphi AFAIK
     
  14. theMagicNumber

    theMagicNumber Regular Member

    Joined:
    May 13, 2010
    Messages:
    345
    Likes Received:
    195
    Well, i think the only solution you got is to write a simple php module with cURL and rotate proxies.
    It will be ~10-15 lines, less than an hour for someone familiar with cURL.