Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong IP address logged by swoole when served behind proxy #732

Closed
acelaya opened this issue Apr 20, 2020 · 2 comments · Fixed by #755
Closed

Wrong IP address logged by swoole when served behind proxy #732

acelaya opened this issue Apr 20, 2020 · 2 comments · Fixed by #755
Labels
Milestone

Comments

@acelaya
Copy link
Member

acelaya commented Apr 20, 2020

How Shlink is set-up

  • Shlink Version: All
  • PHP Version: All
  • How do you serve Shlink: Self-hosted swoole|Docker image
  • Database engine used: All

Summary

Currently swoole access logger is logging the IP address from the caller, but if this is a proxy, it should be the forwarded one instead.

Current behavior

The proxy IP address is logged when serving Shlink with swoole behind a proxy.

Expected behavior

The original forwarded IP address is logged instead.


mezzio/mezzio-swoole#9

@acelaya acelaya added the bug label Apr 20, 2020
@acelaya acelaya added this to the 2.2.0 milestone Apr 21, 2020
@neilfrndes
Copy link

Would it be possible to specify a custom log format as mentioned here: https://docs.mezzio.dev/mezzio-swoole/v1/logging/#container-usage ?

It looks like it is possible to set a custom format for logging at docker build time using this config setting:

'mezzio-swoole' => [
     'swoole-http-server' => [
         'options' => [
             'worker_num' => (int) env('WEB_WORKER_NUM', 16),
             'task_worker_num' => (int) env('TASK_WORKER_NUM', 16),
         ],
     ],
 ],

@acelaya
Copy link
Member Author

acelaya commented Apr 26, 2020

Yep, it would be possible. It's something I have considered several times.

However, it's easy to mess it up, so I haven't done it yet because of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants