HTTP rewriter for docker

I want to run a docker container, and somehow intercept/modify HTTP responses in the host. That means, basically take every HTTP response coming out of the container, and modify it before sending it back to the user. Is there a standard way to do this in docker?

  • Docker api: push an image to docker hub private repository
  • Failed to connect to master, spark in docker
  • Add insecure rubygems source and automatically choose 'yes' for 'Do you want to add this insecure source?' (I'm using Docker-Compose)
  • docker-machine on mac does not work with docker-engine protected by self-create CA
  • HTTP 504 Gateway Time-out when serving static file with Django (Nginx + Gunicorn)
  • Unable to Connect to Tensorflow Jupyter Notebook in windows 10
  • Connect to mysql in a docker container from the host
  • How I can connect wp container with ajenti container?
  • Running iPython Notebook in Docker container on Amazon EC2 instance
  • Docker and NodeJS permission denied
  • How do I pass the host's IP address to my container in Docker
  • Docker: multiple sites with common containers
  • 2 Solutions collect form web for “HTTP rewriter for docker”

    What you could do is create a reverse proxy.

    All communication in and out of the docker container is done indirectly, trough the proxy. So clients connect to the reverse proxy, the proxy requests the information from the process inside the container. The proxy will also handle the response to the client.

    If you simply want to change some headers, a default setup of an apache reverse proxy might be enough.
    See this link on how to set up a reverse proxy using apache:

    https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

    Other proxy technologies you might consider:
    – Nginx
    – HAProxy

    If you want to do more than just changing headers (please fill me in!) than you might have to write some code to handle that for you.

    Good luck! And let me know if you need more help!

    Something like mitmproxy. Docker does not change the approach.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.