{"action":"created","issue":{"url":"https://api.github.com/repos/scalaj/scalaj-http/issues/64","labels_url":"https://api.github.com/repos/scalaj/scalaj-http/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/scalaj/scalaj-http/issues/64/comments","events_url":"https://api.github.com/repos/scalaj/scalaj-http/issues/64/events","html_url":"https://github.com/scalaj/scalaj-http/issues/64","id":64546475,"number":64,"title":"Host headers can't be set","user":{"login":"davesmith00000","id":908709,"avatar_url":"https://avatars.githubusercontent.com/u/908709?v=3","gravatar_id":"","url":"https://api.github.com/users/davesmith00000","html_url":"https://github.com/davesmith00000","followers_url":"https://api.github.com/users/davesmith00000/followers","following_url":"https://api.github.com/users/davesmith00000/following{/other_user}","gists_url":"https://api.github.com/users/davesmith00000/gists{/gist_id}","starred_url":"https://api.github.com/users/davesmith00000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davesmith00000/subscriptions","organizations_url":"https://api.github.com/users/davesmith00000/orgs","repos_url":"https://api.github.com/users/davesmith00000/repos","events_url":"https://api.github.com/users/davesmith00000/events{/privacy}","received_events_url":"https://api.github.com/users/davesmith00000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-26T14:54:54Z","updated_at":"2015-03-26T15:24:50Z","closed_at":null,"body":"Love this library and use it for everything, but I've hit a weird edge case that prevents me from using it in one particular case.\r\n\r\nFor reasons I won't go into, I have no DNS lookup available so I have to use the IP address, and the service I'm trying to reach is on a subdomain. I've deduced that the way around this using curl or some other posting tool is to set the host header to what would be the subdomain.domain.tld I'd like to reach.\r\n\r\nAttempting to set the host header using the header method does not work, apparently this is a security feature of the underlying java library. Ok fair enough.\r\n\r\nI tried the same trick with another library (Play's WS) and setting the host is also not allowed there, however, they provide a method called withVirtualHost(\"subdomain.domain.tld\") and that does the magic.\r\n\r\nI'd love it if something similar appeared in this library so I can ditch WS! :)\r\n\r\nIf I get some time I might have a go but it's unlikely :( so I thought I should capture this in an issue."},"comment":{"url":"https://api.github.com/repos/scalaj/scalaj-http/issues/comments/86567788","html_url":"https://github.com/scalaj/scalaj-http/issues/64#issuecomment-86567788","issue_url":"https://api.github.com/repos/scalaj/scalaj-http/issues/64","id":86567788,"user":{"login":"hoffrocket","id":24408,"avatar_url":"https://avatars.githubusercontent.com/u/24408?v=3","gravatar_id":"","url":"https://api.github.com/users/hoffrocket","html_url":"https://github.com/hoffrocket","followers_url":"https://api.github.com/users/hoffrocket/followers","following_url":"https://api.github.com/users/hoffrocket/following{/other_user}","gists_url":"https://api.github.com/users/hoffrocket/gists{/gist_id}","starred_url":"https://api.github.com/users/hoffrocket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoffrocket/subscriptions","organizations_url":"https://api.github.com/users/hoffrocket/orgs","repos_url":"https://api.github.com/users/hoffrocket/repos","events_url":"https://api.github.com/users/hoffrocket/events{/privacy}","received_events_url":"https://api.github.com/users/hoffrocket/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T15:24:50Z","updated_at":"2015-03-26T15:24:50Z","body":"That is an annoying restriction of the java libraries. You can workaround by doing one of the following:\r\nStart your JVM with this command line parameter: ``` -Dsun.net.http.allowRestrictedHeaders=true```\r\nor, do this first thing at runtime: ```System.setProperty(\"sun.net.http.allowRestrictedHeaders\", \"true\")```\r\n\r\nDoes that work for you?"}}