vvidic / mjpeg-proxy

Republish a MJPEG HTTP image stream using a server in Go
GNU General Public License v3.0
22 stars 15 forks source link

Get remote address from headers if behind frontend proxy #6

Closed kescherCode closed 3 years ago

kescherCode commented 3 years ago

This is useful when mjpeg-proxy is sitting behind NGINX, Apache2, Caddy, etc.

vvidic commented 3 years ago

I think for security reasons this should not be on by default. Instead it can be enabled with a flag specifying the header to use.

kescherCode commented 3 years ago

I made the method behave a bit more accurately, and added a flag for enabling the functionality (with the function returning r.RemoteAddr if the flag is disabled, which is the default)

kescherCode commented 3 years ago

Please review the changes with a proper tool. GitHub's diff of this pull request is completely wrong. Edit: Fixed it by doing the good ol' git diff, branch reset to master and git apply method.

vvidic commented 3 years ago

I had a different flag in mind here, please check if this works for you now.

kescherCode commented 3 years ago

Oh, yeah your solution is much more elegant! Closing this pull request.