{"action":"created","issue":{"url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/29","repository_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser","labels_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/29/comments","events_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/29/events","html_url":"https://github.com/BigstickCarpet/json-schema-ref-parser/issues/29","id":191085496,"number":29,"title":"Overriding port for absolute refs when run from browser [3.1.2]","user":{"login":"andru","id":30393,"avatar_url":"https://avatars.githubusercontent.com/u/30393?v=3","gravatar_id":"","url":"https://api.github.com/users/andru","html_url":"https://github.com/andru","followers_url":"https://api.github.com/users/andru/followers","following_url":"https://api.github.com/users/andru/following{/other_user}","gists_url":"https://api.github.com/users/andru/gists{/gist_id}","starred_url":"https://api.github.com/users/andru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andru/subscriptions","organizations_url":"https://api.github.com/users/andru/orgs","repos_url":"https://api.github.com/users/andru/repos","events_url":"https://api.github.com/users/andru/events{/privacy}","received_events_url":"https://api.github.com/users/andru/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-22T18:20:11Z","updated_at":"2016-12-04T16:15:42Z","closed_at":null,"body":"I've got a schema with absolute urls to resources with no port number in the URL...\r\n\r\n```json\r\n{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"id\": \"http://localhost/schema/01/plantdb.json\",\r\n  \"type\": \"object\",\r\n  \"properties\": {\r\n    \"names\": {\"$ref\": \"http://localhost/schema/01/names.json\"}\r\n  }\r\n}\r\n```\r\n(greatly simplified for clarity)\r\n\r\nand I'm loading this on the client from an app hosted at `localhost:3000`. Trying to dereference a schema file hosted on the same hostname, but without specifying a port number...\r\n\r\n```js\r\nparser.dereference('http://localhost/schema/01/plantdb.json')\r\n``` \r\n\r\nactually tries to load the schema from `http://localhost:3000/schema/01/plantdb.json` and fails with an invalid schema error. If I explicitly add the port number to the schema URL:\r\n\r\n```js\r\nparser.dereference('http://localhost:80/schema/01/plantdb.json')\r\n```\r\n\r\nthen that schema file loads, but all refs within are still loaded from port `http://localhost:3000`.\r\n\r\nIs this a bug, or is there a config somewhere I'm missing to force the port number on ref requests?"},"comment":{"url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/comments/264712954","html_url":"https://github.com/BigstickCarpet/json-schema-ref-parser/issues/29#issuecomment-264712954","issue_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/29","id":264712954,"user":{"login":"BigstickCarpet","id":3453903,"avatar_url":"https://avatars.githubusercontent.com/u/3453903?v=3","gravatar_id":"","url":"https://api.github.com/users/BigstickCarpet","html_url":"https://github.com/BigstickCarpet","followers_url":"https://api.github.com/users/BigstickCarpet/followers","following_url":"https://api.github.com/users/BigstickCarpet/following{/other_user}","gists_url":"https://api.github.com/users/BigstickCarpet/gists{/gist_id}","starred_url":"https://api.github.com/users/BigstickCarpet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BigstickCarpet/subscriptions","organizations_url":"https://api.github.com/users/BigstickCarpet/orgs","repos_url":"https://api.github.com/users/BigstickCarpet/repos","events_url":"https://api.github.com/users/BigstickCarpet/events{/privacy}","received_events_url":"https://api.github.com/users/BigstickCarpet/received_events","type":"User","site_admin":false},"created_at":"2016-12-04T16:15:42Z","updated_at":"2016-12-04T16:15:42Z","body":"@andru - Wow, thanks for the thorough explanation!  I like your idea of setting _both_ `hostname` and `host`.  That's probably the best solution for now, and I'd gladly accept a PR from you.\r\n\r\nWhenever I get a chance, I plan to resume working on [JSON Schema $Ref Parser v4.0](https://github.com/BigstickCarpet/json-schema-ref-parser/tree/releases/4.0.0), and one of the changes that I plan to make is getting rid of HTTP-Browserify, probably in favor of [Axios](https://github.com/mzabriskie/axios) or something"}}
{"actor":{"display_login":"BigstickCarpet"}}