Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/app/service/mcp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func addProxy(server *model.McpServer) {
if !ok {
return
}
location.UpdateDirective("proxy_pass", []string{fmt.Sprintf("http://127.0.1:%d%s", server.Port, server.SsePath)})
location.UpdateDirective("proxy_pass", []string{fmt.Sprintf("http://127.0.0.1:%d%s", server.Port, server.SsePath)})
location.ChangePath("^~", server.SsePath)
if err = nginx.WriteConfig(config, nginx.IndentedStyle); err != nil {
global.LOG.Errorf("write config failed, err: %v", buserr.WithErr(constant.ErrUpdateBuWebsite, err))
Expand Down Expand Up @@ -486,7 +486,7 @@ func addMCPProxy(websiteID uint) error {
err = errors.New("error")
return err
}
location.UpdateDirective("proxy_pass", []string{fmt.Sprintf("http://127.0.1:%d%s", server.Port, server.SsePath)})
location.UpdateDirective("proxy_pass", []string{fmt.Sprintf("http://127.0.0.1:%d%s", server.Port, server.SsePath)})
location.ChangePath("^~", server.SsePath)
if err = nginx.WriteConfig(config, nginx.IndentedStyle); err != nil {
return buserr.WithErr(constant.ErrUpdateBuWebsite, err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code differences appear to be minor adjustments regarding IP addresses used in the proxy_pass directive of an Nginx configuration file. The changes from "127.0.1" to "127.0.0.1" do not significantly impact functionality since both represent the loopback interface but are different ways of referencing it in IPv4 notation.

Here is a concise summary of my observations:

Proper Use: Both IPs (127.0.1 and 127.0.0.1) are correct representations of localhost within IPv4 context, so there should be no functional difference between them.

Optimization Suggestions:

  • Ensure that the server.SsePath variable correctly includes only necessary path information ("^~" implies it might need trimming).
  • Consider adding logging statements around potentially error-prone operations like writing the NGINX config and handling specific errors appropriately.

No major inconsistencies are found beyond these minor details.

Expand Down
Loading