{"action":"created","issue":{"url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/111","labels_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/111/comments","events_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/111/events","html_url":"https://github.com/mesosphere/mesos-dns/issues/111","id":63771067,"number":111,"title":"Add HTTP redirector","user":{"login":"quofelix","id":9284692,"avatar_url":"https://avatars.githubusercontent.com/u/9284692?v=3","gravatar_id":"","url":"https://api.github.com/users/quofelix","html_url":"https://github.com/quofelix","followers_url":"https://api.github.com/users/quofelix/followers","following_url":"https://api.github.com/users/quofelix/following{/other_user}","gists_url":"https://api.github.com/users/quofelix/gists{/gist_id}","starred_url":"https://api.github.com/users/quofelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quofelix/subscriptions","organizations_url":"https://api.github.com/users/quofelix/orgs","repos_url":"https://api.github.com/users/quofelix/repos","events_url":"https://api.github.com/users/quofelix/events{/privacy}","received_events_url":"https://api.github.com/users/quofelix/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-03-23T16:43:52Z","updated_at":"2015-08-12T07:43:32Z","closed_at":"2015-08-12T07:43:32Z","body":"This way, any port that happens to be HTTP is reachable on a well-defined address via a web-browser.\r\n\r\nYou just need to add a wildcard DNS record (*.redir.corp.com) that points to the mesos-dns machine, run the mesos-dns http port on 80, and you can directly reach all tasks like so:\r\n\r\nhttp://_prometheus._tcp.marathon.mesos.redir.corp.com\r\n\r\nProbably not belonging into mesos-dns from a purist point of view, but it is so simple and useful. Not fluent in Go though, otherwise I'd do it myself.\r\n\r\nI hacked this in Python: \r\n```\r\nimport urlparse\r\nimport SimpleHTTPServer\r\nimport SocketServer\r\nimport DNS\r\n\r\nPORT = 80\r\nHOSTNAME = 'redir.corp.com'\r\n\r\nDNS.ParseResolvConf()\r\nsrv_req = DNS.Request(qtype = 'srv')\r\n\r\nclass Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):\r\n  def do_POST(self):\r\n    return self.do_GET()\r\n\r\n  def do_HEAD(self):\r\n    return self.do_GET()\r\n\r\n  def do_DELETE(self):\r\n    return self.do_GET()\r\n\r\n  def do_GET(self):\r\n    if ':' in self.headers['Host']:\r\n      host, port = self.headers['Host'].split(':')\r\n    else:\r\n      host = self.headers['Host']\r\n    target = host.replace(HOSTNAME, '')\r\n    print \"Request to \", target, self.path\r\n\r\n    srv_result = srv_req.req(target)\r\n    for result in srv_result.answers:\r\n      if result['typename'] == 'SRV':\r\n        print \"Found SRV for\", target, result['data']\r\n        prio, x, port, host = result['data']\r\n        self.send_response(303)\r\n        dest = \"http://%s:%d%s\" % (host, port, self.path)\r\n        print \"Redirecting to\", dest\r\n        self.send_header('Location', dest)\r\n        self.end_headers()\r\n        self.wfile.write('Redirecting to ' + dest)\r\n        return\r\n\r\n    self.send_error(404,'File Not %s' % target)\r\n    return\r\n\r\nSocketServer.BaseServer.allow_reuse_address = True\r\nhttpd = SocketServer.TCPServer((\"\", PORT), Handler)\r\n\r\nprint \"serving at port\", PORT\r\nhttpd.serve_forever()\r\n```"},"comment":{"url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/comments/130204215","html_url":"https://github.com/mesosphere/mesos-dns/issues/111#issuecomment-130204215","issue_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/111","id":130204215,"user":{"login":"tsenart","id":67471,"avatar_url":"https://avatars.githubusercontent.com/u/67471?v=3","gravatar_id":"","url":"https://api.github.com/users/tsenart","html_url":"https://github.com/tsenart","followers_url":"https://api.github.com/users/tsenart/followers","following_url":"https://api.github.com/users/tsenart/following{/other_user}","gists_url":"https://api.github.com/users/tsenart/gists{/gist_id}","starred_url":"https://api.github.com/users/tsenart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsenart/subscriptions","organizations_url":"https://api.github.com/users/tsenart/orgs","repos_url":"https://api.github.com/users/tsenart/repos","events_url":"https://api.github.com/users/tsenart/events{/privacy}","received_events_url":"https://api.github.com/users/tsenart/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T07:43:32Z","updated_at":"2015-08-12T07:43:32Z","body":"@quofelix: https://github.com/mesosphere/redir"}}