Articles of mod proxy

禁用反向代理的authentication摘要

我已经在我的一个域上设置了auth设置,但我想禁用它作为反向代理。 <VirtualHost *:80> ServerName example.org DocumentRoot /var/www/ <Directory /var/www/> BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On AuthType Digest AuthName "Internal" AuthDigestDomain http://example.org/ AuthDigestProvider file AuthUserFile /etc/apache2/example.digest Require valid-user Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ExpiresActive On ExpiresDefault "access plus 7 days" ProxyRequests Off ProxyPreserveHost On ProxyPass /api/ http://api.otherdomain.com/ retry=0 nocanon ProxyPassReverse /api/ http://api.otherdomain.com/ AllowEncodedSlashes […]

Apache代理和基本身份validation

我试图build立一个也代理LDAP基本身份validation的Apache代理: <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ProxyPass / http://localhost:8080/ nocanon ProxyPassReverse / http://localhost:8080/ ProxyPreserveHost On ProxyRequests Off AllowEncodedSlashes NoDecode RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "443" <Location /> AuthType Basic AuthName "LDAP Login for access" AuthBasicProvider ldap AuthLDAPBindDN USER@DOMAIN AuthLDAPBindPassword PASSWORD AuthLDAPURL ldaps://FQDN:636/CN=..,OU=..?uid?sub Require valid-user </Location> ProxyPass在没有AuthType Basic部分的情况下工作,但是,如果合并,BasicAuth会要求input凭据,然后服务器会抛出一个500错误,而不会在他的error.log 我错过了什么?

ProxyPassReverse指令的用途是什么?

从apache.org定义说: 这个指令让Apache httpd调整HTTPredirect响应上的Location,Content-Location和URI头中的URL。 当Apache httpd被用作反向代理(或网关)时,这是非常重要的,以避免绕过反向代理,因为后端服务器上的HTTPredirect会停留在反向代理之后。 只有上面特别提到的HTTP响应头才会被重写。 Apache httpd不会重写其他响应头文件,也不会重写HTML页面中的URL引用。 这意味着如果代理内容包含绝对URL引用,他们将绕过代理。 要重写HTML内容以匹配代理,您必须加载并启用mod_proxy_html。 path是本地虚拟path的名称; url是远程服务器的部分URL。 这些参数的使用方式与ProxyPass指令相同。 有人可以请解释我是如何工作的。 一般来说,这个指令是做什么的?

在Apache mod重写中dynamic设置RequestHeader主机

我正在使用Apache mod_rewrite,我正在寻找基于QUERY_STRING的域dynamic设置RequestHeader的Host头。 我将如何dynamic设置Host ? 鉴于以下请求URL: https://example.com/p12?url=http://nonssldomain.com/331551/1041505584.jpg?dt=032620151151 我试过了: RewriteCond %{QUERY_STRING} ^url=(.*)$ [NC] #some regex to parse domain from Query_String (Doesn't work) RequestHeader set Host ^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+) RewriteRule ^.*/p12$ %1? [P,NC,L] 我需要dynamic设置一个variables吗?

Apache的mod_proxy,页面重新加载和会话

我使用apache“mod_proxy”将所有请求转发到glassfish服务器。 相关的apacheconfiguration是: # proxy to glassfish app ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /myAppVaadin/VAADIN/ http://127.0.0.1:8080/myAppVaadin/VAADIN/ ProxyPassReverse /myAppVaadin/VAADIN/ http://127.0.0.1:8080/myAppVaadin/VAADIN/ ProxyPass /myAppVaadin/APP/ http://127.0.0.1:8080/myAppVaadin/APP/ ProxyPassReverse /myAppVaadin/APP/ http://127.0.0.1:8080/myAppVaadin/APP/ ProxyPass / http://127.0.0.1:8080/myAppVaadin/ ProxyPassReverse / http://127.0.0.1:8080/myAppVaadin/ 问题如下: 如果我使用没有代理的Vaadin Web应用程序,那么浏览器页面重新加载button重新加载当前视图,而不创build新的会话。 但是,如果我使用apache代理的web应用程序的页面重新加载button创build一个新的会话(我必须再次login到我的应用程序)。 有谁知道我可以如何防止我得到一个新的会话,如果我重新加载一个网页通过使用Apache代理? 感谢和问候,Steffen PS:与mod_proxy_ajp我有同样的效果

httpd:如何dynamic延迟请求转发到代理?

我有Apache httpd(2.2.22)configuration为反向代理。 在这种情况下,我需要将我的Web服务器(代理请求的接收者)离线几毫秒。 在此期间,Web服务器不应收到任何请求,但我也不想拒绝任何请求。 我想要做的是以某种方式让httpd延迟这段时间的所有请求。 在步骤中: 告诉httpd延迟所有的请求,直到另行通知 停止Web服务器 启动networking服务器 继续从httpd转发请求 一个固定的延迟也可以做到这一点,但由于我无法预见Web服务器将离线的实际时间(除此之外它将不到一秒),dynamic方法将更适合。 我已经看过mod_proxy或mod_balancer如何能够帮助我,但我没有find一个明显的解决scheme。 我会很高兴你可以给我的任何指针。 编辑: 看起来像一个静态的方法就足够了。 一些有用的资源: httpd ProxyPass httpd ProxyTimeout ProxyPass与mod_rewrite (无需明确使用ProxyPass;不需要使用ProxyPassInterpolateEnv) 另请参阅这篇文章 ,讨论关于httpd返回503立即(代理和平衡器)的讨论。 替代scheme: 我们将把systemd部署到我们的服务器上。 systemd将解决我的问题,因为它可以保留在一端closures的套接字的请求。 这意味着,当我停止后端服务器很短的时间,所有的请求将排队,直到我再次启动并连接到套接字。 这就是我所说的优雅:)

Apache服务器:通过mod_proxy_wstunnel反向代理和websockets

我有一个networking套接字和我的反向代理Apache的一个小问题,我已经在最新版本2.4.5升级,并加载模块mod_proxy_wstunnel。 httpd.conf: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName www.toto.fr ServerAlias toto.fr ProxyPass /my_app http://1X.XX1:8080/my_app ProxyPassReverse /web_pmr http://1X.XX1:8080/my_app ProxyPassReverseCookiePath /my_app / ProxyPassReverseCookieDomain localhost my_app ProxyRequests off ProxyTimeout 15 #WEBSOCKETS ProxyPass /my_app/BasicWebsocketServlet ws://1X.XX1:8080/my_app/BasicWebsocketServlet retry=0 ProxyPassReverse /my_app/BasicWebsocketServlet ws://1X.XX1:8080/web_pmr/BasicWebsocketServlet retry=0 ErrorLog "logs/my_app_error.log" LogLevel debug CustomLog "logs/my_app_access.log" combined <Proxy *> Order deny,allow Allow from all </Proxy> </VirtualHost> 当我testing我的本地URL,websockets正在工作,但与反向代理apache在tomcat日志中没有跟踪。 加载模块列表: Loaded Modules: […]

Apache作为Nexus,Jenkins和Foreman的代理(在相同域,IP和端口上的多个VirtualHost)

我想将Apacheconfiguration为在同一台服务器上安装并运行的Nexus,Jenkins和Foreman的代理。 这里是Foreman的虚拟主机configuration文件的示例,Nexus和Jenkins的其他文件看起来非常相似,除了代理传递参数。 LoadModule ssl_module modules/mod_ssl.so NameVirtualHost *:443 <VirtualHost *:443> SSLEngine On SSLProxyEngine On SSLCertificateFile /etc/httpd/ssl/certs/ssl.crt SSLCertificateKeyFile /etc/httpd/ssl/keys/server.key ServerName management.domain.com <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /foreman http://127.0.0.1:3000/foreman ProxyPassReverse /foreman http://127.0.0.1:3000/foreman ProxyPassReverse /foreman http://management.domain.com/foreman ProxyRequests Off ProxyPreserveHost On ErrorLog /var/log/httpd/management.domain.com_foreman_error.log LogLevel warn CustomLog /var/log/httpd/management.domain.com_foreman_access.log combined </VirtualHost> 问题是,Apache只考虑了一个configuration文件,而忽略了另外两个导致错误信息“请求的URL / jenkins /在这个服务器上找不到的”。 当我尝试访问URL management.domain.com/jenkins 如何configurationApache来加载这三个虚拟主机? […]

Apache mod_proxy AH00927消息

我希望有人可以帮助我与我的apache2和mod_proxy。 我有以下设置: Pythonnetworking服务器1(HTTP) Pythonnetworking服务器2(HTTP) Pythonnetworking服务器n(HTTP) Apache(2.4.7)与mod_proxy与多个VirtualHosts像这样: <VirtualHost *:443> ServerName ws1.domain.com ProxyPass / http://localhost:1234/ ProxyPassRevers / http:/localhost:1234/ …. </VirtualHost> <VirtualHost *:443> ServerName ws2.domain.com ProxyPass / http://localhost:8080/ ProxyPassRevers / http:/localhost:8080/ …. </VirtualHost> <VirtualHost *:443> ServerName wsn.domain.com ProxyPass / http://localhost:5678/ ProxyPassRevers / http:/localhost:5678/ …. </VirtualHost> 我最近在看我的apache-error.log文件,它充斥着以下消息: [Fri Dec 11 21:26:43.989831 2015] [proxy:debug] [pid 23813] proxy_util.c(1734): AH00927: initializing worker […]

VirtualHosts上的Apache RewriteRule不适用于组捕获正则expression式

我需要创build一个RewriteRule来将像/tdg/image.jpg?mode=crop&width=300&height=300这样的URLpath/tdg/image.jpg?mode=crop&width=300&height=300给本地代理。 代理需要将给定的URL转换为以下格式。 http://localhost:8888/unsafe/300×300/smart/tdg/image.jpg 我先尝试使用ProxyPassMatch apache指令,但是我无法从查询string中检索宽度和高度数据。 ProxyRequests On ProxyPreserveHost On ProxyPassMatch ^\/(tdg.+\.(?:png|jpeg|jpg|gif))\?mode=crop.+width=(d+)&height=(d+) http://localhost:8888/unsafe/$2x$3/smart/$1 我也试过RewriteRule RewriteEngine On RewriteRule ^\/(tdg.+\.(?:png|jpeg|jpg|gif))\?mode=crop.+width=(d+)&height=(d+) http://localhost:8888/unsafe/$2x$3/smart/$1 在这两种情况下,代理的结果URL都是http://localhost:8888/unsafe/x/smart/$1 ,其中应该是http://localhost:8888/unsafe/300×300/smart/tdg/image.jpg 我不知道为什么我不能使用group正则expression式从查询string中获取width和height值。