[GH-ISSUE #151] 无法转发302跳转的http请求 #95

Closed
opened 2026-05-05 11:45:11 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @dxvgef on GitHub (Nov 3, 2016).
Original GitHub issue: https://github.com/fatedier/frp/issues/151

我用golang的iris框架在内网开发一个web应用,发现用了iris的ctx.Redirect()函数触发了302跳转,请求会无法转发到内网来,我在iris的日志里根本看不到有302跳转之后的地址请求,直接用内网IP访问就是正常的,之前用ngrok1.x也是正常的,目前排除到最后只可能是frp的问题了

Originally created by @dxvgef on GitHub (Nov 3, 2016). Original GitHub issue: https://github.com/fatedier/frp/issues/151 我用golang的iris框架在内网开发一个web应用,发现用了iris的ctx.Redirect()函数触发了302跳转,请求会无法转发到内网来,我在iris的日志里根本看不到有302跳转之后的地址请求,直接用内网IP访问就是正常的,之前用ngrok1.x也是正常的,目前排除到最后只可能是frp的问题了
Author
Owner

@maodanp commented on GitHub (Nov 4, 2016):

  • 关于http请求的302跳转,想确认下ctx.Redirect()的跳转是否是web应用内的跳转,还是跳转到其他域名?
  • 能够提供些frps、frpc的日志信息?
<!-- gh-comment-id:258331354 --> @maodanp commented on GitHub (Nov 4, 2016): - 关于http请求的302跳转,想确认下`ctx.Redirect()`的跳转是否是web应用内的跳转,还是跳转到其他域名? - 能够提供些frps、frpc的日志信息?
Author
Owner

@dxvgef commented on GitHub (Nov 4, 2016):

跳转到应用内同域名下的另一个url,还是用的/xxx/xxx这样的相对路径跳转的,没有记录日志

<!-- gh-comment-id:258360041 --> @dxvgef commented on GitHub (Nov 4, 2016): 跳转到应用内同域名下的另一个url,还是用的/xxx/xxx这样的相对路径跳转的,没有记录日志
Author
Owner

@maodanp commented on GitHub (Nov 5, 2016):

我这边写了个demo,测试内网跳转是没问题的,代码如下:

func main() {

        iris.Get("/", func(ctx *iris.Context) {
                //ctx.Write("Hello, %s", "World!")
                ctx.Redirect("/myjson", 302)
        })

        iris.Get("/myjson", func(ctx *iris.Context) {
                ctx.JSON(iris.StatusOK, iris.Map{
                        "Name":     "Iris",
                        "Released": "13 March 2016",
                        "Stars":    5525,
                })
        })
       iris.Listen(":8080")
}
  • 想确认下您那边运行这段demo是否无法正常跳转?或者有无其他http response的设置?
  • 方便的话能否贴出跳转的代码段,或者能否提供您那边连接frps的公网地址?方便连接
  • frps, frpc默认都有日志信息的,希望您能够提供下,尽量帮助我们排查问题
<!-- gh-comment-id:258582319 --> @maodanp commented on GitHub (Nov 5, 2016): 我这边写了个demo,测试内网跳转是没问题的,代码如下: ``` go func main() { iris.Get("/", func(ctx *iris.Context) { //ctx.Write("Hello, %s", "World!") ctx.Redirect("/myjson", 302) }) iris.Get("/myjson", func(ctx *iris.Context) { ctx.JSON(iris.StatusOK, iris.Map{ "Name": "Iris", "Released": "13 March 2016", "Stars": 5525, }) }) iris.Listen(":8080") } ``` - 想确认下您那边运行这段demo是否无法正常跳转?或者有无其他`http response`的设置? - 方便的话能否贴出跳转的代码段,或者能否提供您那边连接frps的公网地址?方便连接 - `frps, frpc`默认都有日志信息的,希望您能够提供下,尽量帮助我们排查问题
Author
Owner

@fatedier commented on GitHub (Nov 5, 2016):

@maodanp @dxvgef http 请求目前还没有日志,之后会考虑加上 access log。

<!-- gh-comment-id:258584841 --> @fatedier commented on GitHub (Nov 5, 2016): @maodanp @dxvgef http 请求目前还没有日志,之后会考虑加上 access log。
Author
Owner

@dxvgef commented on GitHub (Nov 7, 2016):

@maodanp 我跳转后是渲染了html文件,不是输出json字符串,我代码结构有点复杂,只贴一部份出来估计看不出什么,最主要的是我已经换回ngrok了,没法再重现bug了

<!-- gh-comment-id:258792987 --> @dxvgef commented on GitHub (Nov 7, 2016): @maodanp 我跳转后是渲染了html文件,不是输出json字符串,我代码结构有点复杂,只贴一部份出来估计看不出什么,最主要的是我已经换回ngrok了,没法再重现bug了
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#95
No description provided.