Skip to content

parseTrustedProxies not executed #2791

@xcaptain

Description

@xcaptain

If not using app.Run to run a gin server,

gin/gin.go

Line 344 in caf2802

err = engine.parseTrustedProxies()

won't be executed. and will cause this line not executed

gin/context.go

Line 786 in caf2802

if c.engine.trustedCIDRs != nil {

Which will cause

gin/context.go

Line 735 in caf2802

func (c *Context) ClientIP() string {
not returning the correct ip adress.

I suggest moving this parseTrustedProxies to Default, so c.engine.trustedCIDRs won't be nil.

related issues: #2632

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions