AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1095107
Accepted
user515576
user515576
Asked: 2022-03-02 12:50:11 +0800 CST2022-03-02 12:50:11 +0800 CST 2022-03-02 12:50:11 +0800 CST

Nginx 入口 - 转义字符

  • 772

我有以下通过 nodePort 32100 公开的入口配置。当我调用(卷曲)包含括号的 URL [1] 时,我收到 HTTP 500 错误。但是当我调用不包含括号的 URL [2] 时,请求通过 NGINX 入口控制器(v0.35.0)成功传递。

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
    name: test1-app-ingress
  namespace: test1
spec:
  rules:
  - host: ing1.example.com
    http:
      paths:
      - backend:
          serviceName: test1-app-1-ingress
          servicePort: 80
        path: /test1
  - host: ing2.example.com
    http:
      paths:
      - backend:
          serviceName: test1-app-2-ingress
          servicePort: 80
        path: /test1

[1]

curl  "http://ing1.example.com:32100/test1/test1.json/Streams(Type_4000000)" -X POST --data-binary @25kfile 
* About to connect() to ing1.example.com port 32100 (#0)
*   Trying 10.10.10.30...
* Connected to ing1.example.com (10.10.10.30) port 32100 (#0)
> POST /test1/test1.json/Streams(Type_4000000) HTTP/1.1
> User-Agent: curl/7.29.0
> Host: ing1.example.com:32100
> Accept: */*
> Content-Length: 25000
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Server: nginx
< Date: Tue, 01 Mar 2022 20:08:07 GMT

应用程序日志:

10.113.4.0 - - [01/Mar/2022:20:08:07 +0000] "POST /test1/test1.json/Streams(Type_4000000) HTTP/1.0" 500 528 "-" "curl/7.29.0" 25283 0.004 [test1-test1-app-1-ingress-80] [] 10.113.4.157:80 528 0.003 500 4b3fd4d41fb8a2d26691bd2da78f24b

[2]

curl  "http://ing1.example.com:32100/test1/test1.json/StreamsType_4000000" -X POST --data-binary @25kfile 
* About to connect() to ing1.example.com port 32100 (#0)
*   Trying 10.10.10.30...
* Connected to ing1.example.com (10.10.10.30) port 32100 (#0)
> POST /test1/test1.json/StreamsType_4000000HTTP/1.1
> User-Agent: curl/7.29.0
> Host: ing1.example.com:32100
> Accept: */*
> Content-Length: 25000
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 01 Mar 2022 20:09:59 GMT

应用程序日志:

172.28.120.65 - - [01/Mar/2022:20:09:59 +0000] "POST /test1/test1.json/StreamsType_4000000 HTTP/1.0" 200 0 "-" "curl/7.29.0" 25281 0.003 [test1-test1-app-1-ingress-80] [] 10.113.4.157:80 0 0.003 200 133bbb4f7149d31e75cf78158566efee

这是 NGINX IC 的问题吗?我应该转义入口配置上的任何字符,比如括号吗?

rewrite nginx kubernetes nginx-ingress
  • 1 1 个回答
  • 142 Views

1 个回答

  • Voted
  1. Best Answer
    Tero Kilkanen
    2022-03-06T11:01:20+08:002022-03-06T11:01:20+08:00

    应用程序的日志文件表明请求到达了应用程序。这意味着“500”错误代码是由应用程序发送的。因此,您无法在 nginx 端做任何事情来解决这种情况。

    您需要确保应用程序正确处理请求。

    • 0

相关问题

  • 阿帕奇虚拟主机

  • IIS 7 中的 URL 重写

  • IIS7 请求跟踪日志上的 URL_CHANGED 事件是什么?

  • 如何强制我的网址始终以 www 开头?

  • mod_rewrite 不转发 GET 参数

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve