dthh5038 2012-03-25 18:47
浏览 64

重写URL的Glype(nginx)

I've a Glype proxy and I want to rewrite the URL's. All URLs on the page are automatically converted to: http://proxy.com/browse.php?u=[URL HERE]. Example: If I go to /browse on The Pirate Bay on my proxy I want to convert the URL from this:

proxy.com/tpb/browse.php?u=http%3A%2F%2Fthepiratebay.se%2Fbrowse&b=0

To this:

proxy.com/tpb/browse

As you can see, the whole part:

browse.php?u=http%3A%2F%2Fthepiratebay.se%2F

Is gone (and the &b=0 what is behind the URL). And it has the same domain structure as The Pirate Bay .

I've tried something like this:

        location /tpb/ {
        rewrite ^/browse.php?u=(.*)$ /$1? last;
        break;
            }

But it is not working. Somebody has an answer? An other function is also welcome. (Such as fastcgi_split_path_info or something else what is compatible with nginx)

(If you want see a example go to tpb.piratenpartij.nl but I'm not sure if they are using Glype)

  • 写回答

1条回答 默认 最新

  • dongliao1948 2012-03-25 19:36
    关注

    I think that proxy.com/tpb/browse.php?u=http%3A%2F%2Fthepiratebay.se%2Fbrowse&b=0 would match location /tpb/browse.php, so you can write

    location /tpb/browse.php {
        rewrite ^/tpb/browse\.php.* $host/tpb/browse redirect;
    }
    

    Hope it does what you wanted, it does not care about ?u=, do you really need it?

    Let me know if it works, I have nowhere to try it right now.

    评论

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab