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

Adding HTTP_X_FORWARDED_PROTO in haproxy #75

Closed
zerowebcorp opened this issue Dec 6, 2016 · 3 comments
Closed

Adding HTTP_X_FORWARDED_PROTO in haproxy #75

zerowebcorp opened this issue Dec 6, 2016 · 3 comments

Comments

@zerowebcorp
Copy link

I was trying to setup docker-flow-proxy with SSL and my backend checks for HTTP_X_FORWARDED_PROTO header to determine if the connection is https or not and if it is not https it redirects the user to https domain name. However, because the haproxy template doesn't support this out of the box, the script was looping and eventually timed out.

Finally, I ended up creating new image with a custom haproxy.tmpl file with the extra content

frontend services
    bind *:80
    bind *:443{{.CertsString}}
    mode http
    option http-server-close
    option forwardfor
    http-request set-header X-Forwarded-Proto https if { ssl_fc }

I want to make a feature request to add the option to add extra headers in the haproxy( may be using a curl call ) so that it is more customizable and users don't have to maintain their own proxy image.

@vfarcic
Copy link
Owner

vfarcic commented Dec 6, 2016

I'm thinking on adding a new environment variable called FRONT_END_SUFFIX. Whatever would be inside that variable will be added to the end of the frontend section. Multiple lines can be separated with comma (,). The proxy would also accept a new PUT request on /api/v1/frontend that would work in the same way as the env. var. FRONT_END_SUFFIX. That way, additional frontend options could be added either by creating the container or later on through HTTP request.

Do you think that such an approach would work. Any other suggestion is welcome.

@zerowebcorp
Copy link
Author

That would work I guess. I do not have much in-depth knowledge in docker flow proxy to suggest otherwise.

@vfarcic
Copy link
Owner

vfarcic commented Dec 19, 2016

See the release 1.125 for more info.

Please let me know if it worked and fulfils your needs.

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

No branches or pull requests

2 participants