我们有?在 url 中,ajp 将其转换为 %3F

发布于 2024-09-19 18:12:38 字数 658 浏览 5 评论 0原文

使用 Mod_jk 连接器,我们将其保存在 /etc/apache2/sites-available 文件中:

RewriteRule /$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L] 这很好用。 www.recycledplants.com 将带您到达正确的地方。

然而,在 Ubuntu 10.04 服务器上,我们设置 ajp 而不是 mod_jk 。所以我们有

ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants

当我尝试访问recycledplants.randrinc.com(用于测试的URL)时,我收到404错误和

描述:请求的资源(/op_ugw/orderportal/home%3Fswitchprofile=RecyledPlants)不可用。

这 ?已转换为 %3F。

有没有办法阻止 Apache 转换?到 %3F。

希望这是有道理的。 谢谢 安

with the Mod_jk connector we have this in our /etc/apache2/sites-available file:


RewriteRule /$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L]

This works fine. and www.recycledplants.com will get you to the correct place.

However on Ubuntu 10.04 server we setup ajp instead of mod_jk . so we have

ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants
ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants

When I try to get to recycledplants.randrinc.com (url for testing) I get a 404 error and

description: The requested resource (/op_ugw/orderportal/home%3Fswitchprofile=RecyledPlants) is not available.

the ? has been converted to %3F.

Is there a way to stop Apache from converting the ? to %3F.

Hope this makes sense.
thanks
Ann

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溺渁∝ 2024-09-26 18:12:38

在 Java Ranch 上得到了一些指导,并且能够弄清楚如何实现。这是我所做的:
好的,这是有效的:

/etc/apache2/sites-available 文件,没有 parms/redirect (只是文件的顶部部分):
<代码>
名称VirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

     ServerName ugw.randrinc.com

    DocumentRoot /var/www/ugw/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home
    ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
   etc...etc... etc..


这是当您需要重定向时的样子,在我的例子中,我传递参数并且应用程序执行重定向:
<代码>
名称VirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

    ServerName recycledplants.randrinc.com

    DocumentRoot /var/www/recycledplants/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009
    ProxyPassReverse / ajp://10.1.1.1:8009

    <Proxy *>
      Order deny,allow
      Allow from all
      RewriteEngine On
      RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L]
    </Proxy>
<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
  etc....etc....etc


希望这对某人有帮助。我还在 Amazon 云服务器上运行 Ubuntu 10.04。
格式有点问题,但我想你可以阅读。

got some pointers over on Java Ranch and was able to figure it how. Here is what I did:
Ok, here is what works:

/etc/apache2/sites-available file with no parms/redirect (just the top section of the file ):

NameVirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

     ServerName ugw.randrinc.com

    DocumentRoot /var/www/ugw/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home
    ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
   etc...etc... etc..


Here is what it looks like when you need to redirect, in my case i am passing parms and the application does the redirecting:

NameVirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

    ServerName recycledplants.randrinc.com

    DocumentRoot /var/www/recycledplants/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009
    ProxyPassReverse / ajp://10.1.1.1:8009

    <Proxy *>
      Order deny,allow
      Allow from all
      RewriteEngine On
      RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L]
    </Proxy>
<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
  etc....etc....etc


Hopes this helps someone. Also I am running on Ubuntu 10.04 on an Amazon cloud server.
Having a little trouble formatting, but I think you can read.
Ann

浮生面具三千个 2024-09-26 18:12:38

如果我正确理解你的问题:在 RewriteRule 末尾添加“NE”

该标志可防止 mod_rewrite 将常用的 URI 转义规则应用于重写结果。通常,特殊字符(例如“%”、“$”、“;”等)将被转义为其对应的十六进制代码(分别为“%25”、“%24”和“%3B”);该标志可以防止这种情况发生。

RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L,NE] 

您可以在 apache mod_rewrite 文档中阅读有关其工作原理的更多信息: http://httpd .apache.org/docs/2.0/mod/mod_rewrite.html

If I understand your question correctly: Add a "NE" to the end of the RewriteRule.

This flag prevents mod_rewrite from applying the usual URI escaping rules to the result of a rewrite. Ordinarily, special characters (such as '%', '$', ';', and so on) will be escaped into their hexcode equivalents ('%25', '%24', and '%3B', respectively); this flag prevents this from happening.

RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L,NE] 

You can read more about how this works in the apache mod_rewrite documentation: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文