STUDY WHILE YOU ARE BORING


  • 首頁

  • 搜索

  • 技术

  • Tags

  • 关于我

使用Rewrite 转发代理请求

發表於 March 25, 2020   |   作者: Tim   |   分类: 技术   |   评论

之前代理使用的是
ProxyPass
ProxyPassReverse

按照目录转发比较简单,如下:

ProxyPass /img/ http://target.com/img/
ProxyPassReverse /img/ http://target.com/img/

如果是需要根据详细的请求URI来转发就不行,因为默认pattern1里面是没有QUERY_STRING的,
例如: http://abc.com/index.php?do=new
上面的 do=new 就是 QUERY_STIRNG,所以我们需要用到下面的方法。

RewriteEngine on
RewriteCond %{QUERY_STRING} ^.*new$
RewriteRule / http://target.com/ [L,P]

参考:
https://www.cnblogs.com/legend-song/p/5180929.html

apache, httpd, rewrite, proxy
花开堪折直须折,莫待无花空折枝
没有了

钜添

54 文章
2 分類
1 页面
GitHub 日记技术
php apache centos macos mysql https shadowsocks mac 微信 ups svn javascript outline accesskey Chrome Extension letsencrypt ssl free certification certbo wildcard renew cloudflare pgsql 归档 binlog isset array_key_exists redmine axure
© 2021 钜添   |   文章 RSS     |  登录
由 Typecho 强力驱动
主題 - NexT
Send message encrypted and private - Msg2
Build your Under Construction Page without hosting - UnderConstruct.IO