【问题标题】:Azure webapps rewriting backslash to slashAzure webapps 将反斜杠重写为斜杠
【发布时间】:2019-10-03 14:53:12
【问题描述】:

我想知道如何解决这个奇怪的问题:

我有一个带有以下内容的 Flask webapp:

@app.route("/tags/<tagname>")
def tag(tagname):
    return lookup(tagname)

问题是源系统中的标签之一有反斜杠:abc\def

使用 urlencode 我得到 url 路径 "/tags/tagname/abc%5Cdef"

在本地构建我的 docker 镜像,效果很好,我可以返回 abc\def 的值。 但是,当我在 Azure webapp 中将此容器用于容器时,它会以 404 响应。

使用包罗万象的路线,我发现
"/tags/tagname/abc%5Cdef" 在本地翻译为 "/tags/tagname/abc\def",但在 Azure 中为“/tags/tagname/abc/def”。当然,这会中断,因为未定义此路由并返回 404。

我现在不知道如何处理 Azure webapp 中的“\”。

【问题讨论】:

  • 我间歇性地遇到同样的问题。你找到解决办法了吗?

标签: python azure flask azure-web-app-service


【解决方案1】:

尝试用几种不同的组合来逃避它

abc\\def
abc^\def
abc^^\def
abc^^^\def
abc&\def

【讨论】:

    猜你喜欢
    • 2015-01-27
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 2013-04-15
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多