Apache LocationMatch:内部重定向后如何再次匹配

发布于 2025-01-17 13:53:01 字数 1130 浏览 4 评论 0原文

我有一个Apache Location -Match,上面有两组重新写入和重写。如果第二套命中率,我想重新启动LoactionMatch。

在我的apache2(apache/2.4.41(ubuntu)mod_wsgi/4.9.0 python/3.8配置)config i有这样的东西:

<LocationMatch ^/incoming-request$>
    RewriteEngine On

    RewriteCond /tmp/test-file -f
    RewriteRule (.*) /some/service [QSA,L]

    RewriteCond /file-associated-with-the-request -f
    RewriteRule (.*) /myapp [L]

</LocationMatch>

where myapp是一个生成/tmp的wsgi脚本/test-file and返回301重定向 and 位置:/incoming-request

/file-file-cassiation-with-with-the-request 总是存在。

到目前为止,一切都很好。

如果/tmp/test-File不存在,则触发/myApp,然后生成/tmp/test-file。然后,我希望location -match再次重新开始,以便/some/service 在第一个循环之后,存在为/tmp/test-file触发。这不会发生。

如果我curl http:// localhost/incoming-request我获得了/tmp/test-file生成的,我从/myApp 。因此,如果我想从/某些/服务获得返回,则必须再次运行卷发。

有没有办法在location -match中再次循环循环,所以我不必两次执行我的请求?

I have a apache LocationMatch with two sets of RewriteCond and RewriteRule. If the second set hits I want to start the LoactionMatch over again.

In my apache2 ( Apache/2.4.41 (Ubuntu) mod_wsgi/4.9.0 Python/3.8 configured) config I have something like this:

<LocationMatch ^/incoming-request
gt;
    RewriteEngine On

    RewriteCond /tmp/test-file -f
    RewriteRule (.*) /some/service [QSA,L]

    RewriteCond /file-associated-with-the-request -f
    RewriteRule (.*) /myapp [L]

</LocationMatch>

Where myapp is a wsgi script which generates the /tmp/test-file and returns 301 redirect and Location: /incoming-request

/file-associated-with-the-request always exists.

So far so good.

If the /tmp/test-file does not exists then trigger the /myapp which then generates the /tmp/test-file. Then I want the LocationMatch to start over again so that the /some/service
is triggered as /tmp/test-file exists after the first loop. This does not happen.

If I curl http://localhost/incoming-request I get the /tmp/test-file generated, and I get the return from /myapp. So if I want to get the return from /some/service I have to run the curl again.

Is there a way to kind of loop over again in the LocationMatch so I dont have to do my request twice?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文