Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON seems to be the only intended return type #8

Open
bjovanovic opened this issue Dec 27, 2013 · 3 comments
Open

JSON seems to be the only intended return type #8

bjovanovic opened this issue Dec 27, 2013 · 3 comments

Comments

@bjovanovic
Copy link

Wrapping content in callback( without quotes/escaping it works well for json content, however it does not work for e.g. html. When trying to pull html cross domain with jsonp (with this module) result is callback(<html...</html>) without any quotes and/or escaping.

We either need a flag of some kind or some other method (including content detection) to determine if the returned content is pure json or something else, and if something else, wrap it in quotes/escape contents.

@agentzh
Copy link
Member

agentzh commented Dec 27, 2013

@bjovanovic Yes, we could add an nginx configuration directive to enable a mode that ngx_xss always quote the response as JSON strings. Will you contribute a patch for this?

@bjovanovic
Copy link
Author

@agentzh Not really super skilled in c/writing stuff in nginx plugins, so not sure I would know how to do this production quality.

Also, not sure that a simple flag would do.. For instance we do want to be able to GET both JSON and HTML files cross domain in our project - for different purposes.

@agentzh
Copy link
Member

agentzh commented Dec 27, 2013

@bjovanovic Well, for more complicated logic, you're recommended to use the ngx_lua module instead: https://github.com/chaoslawful/lua-nginx-module#readme And you'll have more than one option to choose from, ready for production use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants