{"id":28376674,"url":"https://github.com/apiaryio/console-proxy","last_synced_at":"2025-10-11T22:18:57.924Z","repository":{"id":51389677,"uuid":"74956723","full_name":"apiaryio/console-proxy","owner":"apiaryio","description":"Apiary Browser Console ","archived":true,"fork":false,"pushed_at":"2021-05-12T11:18:15.000Z","size":293,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-30T00:07:33.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://help.apiary.io/tools/browser-jsagent/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apiaryio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-28T09:23:04.000Z","updated_at":"2024-11-08T09:04:00.000Z","dependencies_parsed_at":"2022-09-02T06:54:12.960Z","dependency_job_id":null,"html_url":"https://github.com/apiaryio/console-proxy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/apiaryio/console-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fconsole-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fconsole-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fconsole-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fconsole-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apiaryio","download_url":"https://codeload.github.com/apiaryio/console-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fconsole-proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262047822,"owners_count":23250421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T00:07:31.897Z","updated_at":"2025-10-11T22:18:52.904Z","avatar_url":"https://github.com/apiaryio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apiary seed component\n\n**Warning**: This repo is being actively developed - therefore breaking API changes,\nas well concept and architecture revolutions might happen.\n\n## What's up?\n\nThis is a componend meant to act as a proxy between a website and a real server\nto overcome some limitations webservers have even if using CORS headers.\n\n## Context\n\nWe all know that, when making http calls from the browser to a server, we will\nhave access to reduced set of headers due to security restrictions.\n\nFirst of all, you can only access the custom headers you actually sent in the\nrequest. Any additional header added by the browser is (justly) not accesible.\n\nMoreover, when the request is coming back from the server, the range of headers\nyou can actually access from the code is a reduces set dictated by the\n`Access-Control-Allow-Headers` header.\n\nFundamentally, if you want to inspect the things on the client side, you have\nto configure your server to whitelist the headers (and keep that list updated).\n\nThings are different if your request is being performed when you are in the same\ndomain. In this case the security is *relaxed* and you get more informations. Not\nall of them (browser sent headers won't be accessible anyway), but you get more.\n\nStarting from this thought, the idea behind this demo is to show that, if the\n*server side guys* would be willing to host a small `html` [page][1] which would\nsimply contain a script reference, we can make the toy work as if I would be\nmaking the request from the same domain.\n\n## Details\n\n### Usage in your application\nFundamentally all we have here is a React component that should be dropped into\nyour application - it will take care of establishing a connection and provide\na method to forward your requests throught the seed.\n\n```javascript\nSeed.propTypes = {\n  seedUrl: React.PropTypes.string.isRequired,\n  origin: React.PropTypes.string,\n  scope: React.PropTypes.string,\n  debugOutput: React.PropTypes.bool,\n  onReady: React.PropTypes.func\n};\n```\n\n`seedUrl`: The URL where the seed page is being served. This should actually be\non a customer domain, possibly under the same domain where the requests will land.\nIf the value does not start nor with `http:` nor with `https:`, then the component\nwill take the value as the Chrome extension ID it should be communicate with.\n\n`origin`: The origin of the requests. This might be useful if you want to make sure\nthat only matching origins will answer the messages. Ignored when `seedUrl` is null,\nas the Chrome extension provides its own origin specification and verification\nin the manifest file.\n\n`scope`: An indentification string that *MUST* match with the one provided on the\nserving page. Ignored when `seedUrl` is null, as the Chrome extension provides its\n own scope specification and verification in the manifest file.\n\n`debugOutput`: Whether you want or not to output logs from `jschannel` library)\n\n`onReady`: Callback called once actual communication has been established between\nthe parent page and child frame, with an `Error` object passed if something went\nwrong during the process. In case of Chrome extension, it will return an error\nobject with the actual `window.chrome.runtime.lastError`\n\nOnce you've \"rendered\" an instance of the component, you can send requests throught\nits instance method `request`. In order to use it, you might want to save the\ncomponent instance using the `ref` property provided by `React`\n\n```javascript\nconst promise = seed.request(requestOptions);\n```\n\nWhere `requestOptions` is an [Axios Request Config][7] object. Axios is the\nunderlying http client used by this component as it's the most complete,\ncompliant and fault tolerant we found so far. If you're interested more, we've\nbeen testing it a lot on different http edge cases. You can have a look to\n[node-hamms][8] repository\n\nThe returned promise will resolve with an [Axios Response Object][9], or rejected\naccording to the [Axios Handling Errors][10] rules.\n\n### Low level method\n\nIf you need to pass a generic message to _the other side_ (whether it's the iframe\nor the Chrome extension) you can use the lower lever `sendMessage` method.\n\n```javascript\nconst promise = seed.sendMessage({method, params});\n```\n\n- `method`: The method name you would like to call on _the other side_\n\n- `params`: The params that will be passed to that method.\n\n### Usage for development\n\n1. Clone the repository\n2. `npm install`\n3. Go to the `server` directory and `npm install`\n4. Start the server with `npm start` command\n4. Go back in the root directory and type `npm start`\n\n\n[1]: https://github.com/apiaryio/apiary-console-seed/blob/master/serve-seed.ejs\n[2]: https://github.com/apiaryio/apiary-console-seed/blob/master/client/public/apiary-customer-seed.js\n[3]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\n[5]: https://github.com/mozilla/jschannel\n[6]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity\n[7]: https://github.com/axios/axios#request-config\n[8]: https://github.com/apiaryio/node-hamms\n[9]: https://github.com/axios/axios#response-schema\n[10]: https://github.com/axios/axios#handling-errors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiaryio%2Fconsole-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiaryio%2Fconsole-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiaryio%2Fconsole-proxy/lists"}