java - 代理服务器配置

标签 java apache proxy httpserver

我被分配去实现(或者更好地配置)一种http代理服务器。服务器应该支持如下所述的进程:

-用户在浏览器中打开一个具有以下结构的 URL:http://:/resource_name

-代理服务器验证传入 http 请求的 URL 中的资源名称,并确定应将客户端的原始请求转发到的 Web 资源的 URL

-代理服务器转发原始请求,等待从外部网络服务器获得答案,然后将其发回给用户

我正在java中工作,但我不想自己使用套接字来实现代理服务器。相反,我想使用 apache http 服务器。有谁知道是否可以使用 apache http 服务器在配置级别完成这样的任务?如果是这样,怎么办?

预先感谢您的回答!

最佳答案

您可以在 Apache 中使用模块 mod_proxy(转发您的请求)和 mod_rewrite(将外部 URL 映射到应用程序服务器上的 URL)来执行此操作

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

关于java - 代理服务器配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10244881/

相关文章:

apache - .htaccess 从 root( public_html ) 重定向到子目录并拒绝直接访问 root

git - 如何设置 Git 以通过代理

flash - AS3 : Overriding Proxy getProperty method

java - ManyToOne OneToMany 双向 : Retrieve data from reference table

Java:意外的 InputStream 行为

Java同步: atomically moving money across account pairs?

php - Apache 重写到 Nginx 重写

java - Canvas 的面积有多少

php - 有人成功使用 PHP 5.4.4 和 APC 3.1.10 服务高流量吗?

python - 我如何为每个请求(或线程)添加不同的代理到 scrapy