Giter Club home page Giter Club logo

jsonp's Introduction

The hosting for jsonp.afeld.me became too expensive to pay out of pocket, so I have decided to shut this down. Glad so many people found it useful over the years!


JSONProxy Tests

HTTP proxy that enables cross-domain requests to any JSON API. See https://jsonp.afeld.me for documentation. See the releases page for the client library changelog.

Development

Code is written in a combination of JavaScript and TypeScript. The app is written to be deployed to a CloudFlare Worker using Terraform, but can be run locally by doing the following:

  1. Install NodeJS >= 7.6.0.

  2. Install the dependencies.

    npm install
  3. Run the server.

    npm start

See CONTRIBUTING for more info.

Deployment

  1. Install NodeJS >= 7.6.0 and Terraform.

  2. Install the dependencies.

    npm install
  3. Set up CloudFlare.

    1. Sign up for CloudFlare, and ensure you have a domain pointed there for DNS.
    2. Get a CloudFlare API key.
      1. Visit the API Tokens page.
      2. Click Create Token.
      3. Use template for Edit Cloudflare Workers.
      4. Add permissions for DNS and Zone.
    3. Go into the terraform/ directory.
    cd terraform
    1. Create a terraform/terraform.tfvars file.
    cloudflare_account_id = "..."
    cloudflare_token = "..."
  4. Create a Terraform Cloud account.

  5. Set up Terraform.

    terraform init
  6. Deploy the environment.

    cd ..
    npm run deploy

If you use the client library with your own JSONP deployment, override the proxy URL before calling $.jsonp().

$.jsonp.PROXY = 'https://mydomain.com/proxy/path/';

See also

jsonp's People

Contributors

afeld avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar jaredcubilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonp's Issues

Add Bower.json

Please add a bower.json so that this is available for people with the Yeoman Workflow.

use JSONP/CORS middleware

A lot of the functionality could be moved into middleware, specifically:

  • wrapping JSON responses for JSONP
  • setting CORS headers

connect-jsonp is intended for this, but doesn't support CORS and is out-of-date.

Bad Gateway

I get a 502 Bad Gateway when using this (or the code snippets from nodejitsu's documentation).

convert to use streaming

Might alleviate the memory problems. Not sure if it would still be possible verifying that the JSON is valid (to prevent XSS through JSONP), but it might be ok to say "not our problem".

move to new host

https://blog.nodejitsu.com/nodejitsu-joins-godaddy/ ๐Ÿ˜”

  • Look into how redirects are handled for AJAX (via raw requests, jQuery, etc.), to see how seamlessly it can be transitioned โ€“ http://stackoverflow.com/a/2573589/358804
  • Set up a custom domain โ€“ https://jsonp.afeld.me
  • Move to dedicated New Relic account
  • Ensure HTTPS works on new domain
  • Set up redirect
  • Change references to old domain

@indexzero Would love to hear your recommendations about platforms. I use Heroku for (almost?) all of my other (non-Node) personal projects, but open open to other ideas.

App regularly becomes unavailable

The app hosted on Nodejitsu seems to get into some state every three weeks or so where it starts returning "502 - Reached max retries limit". My first thought was that there is a memory leak in the app, which I would think would be resolved by restarting the app through the Nodejitsu control panel, but this doesn't fix it. Redeploying the app solves the problem consistently. I see messages like this repeatedly in the logs:

[err] Tue, 21 Jan 2014 23:18:43 GMT FATAL ERROR:
[err] Tue, 21 Jan 2014 23:18:43 GMT Evacuation Allocation failed - process out of memory

๐Ÿ˜ฌ Ideas appreciated!

/cc @bchelli

jsonp.afeld.me Application Error

It looks like the website, https://jsonp.afeld.me/, is currently down,

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

Application Error Message

Problem With Long URLs Or Many Parameters ?

Is this not working when URL is too long or Is there a limitations for no.of parameters of the URL when using this. This is working perfectly for many URLs, but when the URL is too long I'm getting error messages from my API

Hosted service is down

Hi! ๐Ÿ‘‹ This is a really cool service and I appreciate you letting open source folks use it for free!

I recently started using it for the yargs docs site so that the browser could query the public npm registry (which does not support CORS) to determine the latest published version of yargs in order to render the README for the appropriate tag (instead of always using the master branch, which could be ahead of latest) via Flatdoc.

Anyway, I noticed the service was down today (CloudFlare returns a non-JSONP 521 response for our particular request) which meant our docs were unavailable. I have since patched around this issue, but I was wondering what your short and long term goals for this project are? I.E. do you plan to keep it running as a free service? It seems like you have put a decent amount of thought/work into this, so I'd hate to see it go away.

Regardless, thanks for building this useful service!

Working over https

Hi

We are trying to get the app working on https and are running in to a few issues. We can change the port but we can't seem to get it to serve. Do you have any advice?

Thanks

Facing issue with jquery autocmplete

$( "#city" ).autocomplete({
minlength : 1,
source : 'https://jsonp.nodejitsu.com/?url=http://www.server.com/path/to/getData',
click : function (event, ui) {
$(this).val(ui.item.label);
return false;
}
});
when i start typing in the text field the request is going like
https://jsonp.nodejitsu.com/?url=http://www.server.com/path/to/getData&term=usa
but it should be like
https://jsonp.nodejitsu.com/?url=http://www.server.com/path/to/getData?term=usa

For first parameter it should take ? instead of &

handle requests to APIs that are behind CloudFlare

Saw some recurring errors in New Relic, and further investigation showed that CloudFlare is blocking "circular" requests. In other words, a request passes through CloudFlare to get to https://jsonp.afeld.me, but then might pass through CloudFlare again to get to http://www.tornadohq.com, which throws an error. Here is what I wrote to support:

I have an application sitting behind CloudFlare, which allows people to proxy to APIs that don't support cross-domain requests from browsers:

https://jsonp.afeld.me/

Unfortunately, it seems that doing requests to other sites behind CloudFlare gives an Error 1000 ("DNS points to prohibited IP"). A couple examples:

I can see why this protection would be enabled, but am wondering if there is a way around it for legitimate proxy requests that need to pass through CloudFlare twice. Thanks!

use retina-compatible assets

The Travis badge and the "Fork me" ribbon are both regular resolution...should switch them to be higher resolution (or SVGs or HTML+CSS only) to look better on retina displays.

only validate JSON for JSONP requests

Basically, sidestep the need for raw=true. Since there isn't a security issue with responding with non-JSON for normal AJAX requests, we can skip the validation, and let the client deal with the response.

request library returning an empty body on 50% of soundcloud links

On calls to api.soundcloud.com through the proxy (exactly?) 50% of the time an empty body is returned, resulting in {"error":""}

This problem can be replicated on the following domain

https://jsonp.jit.su/?url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F28698952%3Fclient_id%3Dapigee

Reloading causes the inverse of the current result.

Fixed by replacting request module with needle module.

Working fix:

https://seam.li/json/?url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F28698952%3Fclient_id%3Dapigee

request replaced with needle.

Cause unknown.

502 Reached max retries limit

Hello, I am writing an app in phonegap which uses cross domain information retrieval and have been using jsonp.jit.su for the jsonp portion. It worked fine up until about 2 weeks ago when I started getting this error frequently, I can no longer access the website from my home or mobile browsers.

Denial of Service with nested requests to self

This particular request will kill the hosting server

http://127.0.0.1:8000/?url=http%3A%2f%2f127.0.0.1%3A8000%3Furl%3Dhttp%3A%2f%2f%2f127.0.0.1%3A8000%3Furl%3D

Thinking it should probably be a good idea to deny requests to localhost and have a blacklist of hosts that are not allowed so that one could block requests to private lan address, etc.

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Cannot read property 'headers' of undefined
    at Request._callback (/Users/adam_baldwin/Documents/projects/jsonp/server.js:44:41)
    at /Users/adam_baldwin/Documents/projects/jsonp/node_modules/request/main.js:119:22
    at Request.<anonymous> (native)
    at Request.emit (events.js:67:17)
    at ClientRequest.<anonymous> (/Users/adam_baldwin/Documents/projects/jsonp/node_modules/request/main.js:207:10)
    at ClientRequest.emit (events.js:67:17)
    at Socket.<anonymous> (http.js:1163:11)
    at Socket.emit (events.js:67:17)
    at Array.0 (net.js:301:14)
    at EventEmitter._tickCallback (node.js:192:40)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.