# Nginx modifying the jsonp response message

**URL:** <https://www.ruby-forum.com/t/nginx-modifying-the-jsonp-response-message/222976>\
**Category:** NGINX\
**Created:** [September 17, 2012, 10:35pm UTC](https://www.ruby-forum.com/t/nginx-modifying-the-jsonp-response-message/222976 "2012-09-17T22:35:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 17, 2012, 10:35pm UTC](https://www.ruby-forum.com/t/nginx-modifying-the-jsonp-response-message/222976/1 "2012-09-17T22:35:18Z")

</div>

Hi,

We are creating a web api application. In one of our API’s if there are  
any  
validation errors, we are returning the error message in JSONP format.  
In  
the API Request URL user adds a query string parameter  
?jsoncallback=xxxxxxxxxx.

On validation failure we are throwing a 400 bad request JSONP with  
response  
message in the below format.

xxxxxxxxxx({“error”,“error message”})

It is working good in all the environments, where there is no nginx. In  
our  
staging environment we have nginx configured.

Here it is modifying the output as below.

badrequest{“error”,“error message”})

Because of this our front end application is unable to read the response  
message.

Could you please let me know, what configuration setting of nginx could  
cause this problem?

Thanks in Advance  
Venkat.

Posted at Nginx Forum:

> **[nginx modifying the jsonp response message](https://forum.nginx.org/read.php?2,230799,230799#msg-230799)**
>
> Hi, We are creating a web api application. In one of our API's if there are any validation errors, we are returning the error message in JSONP format. In the API Request URL user adds a query string parameter ?jsoncallback=xxxxxxxxxx. On validation...

---

<div class="post-metadata">

**Author:** ![venkat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/4491bb/32.png) [@venkat](https://www.ruby-forum.com/u/venkat)\
**Post date:** [September 18, 2012, 8:56am UTC](https://www.ruby-forum.com/t/nginx-modifying-the-jsonp-response-message/222976/2 "2012-09-18T08:56:32Z")

</div>

Hello!

On Mon, Sep 17, 2012 at 04:34:27PM -0400, venkat wrote:

> xxxxxxxxxx({“error”,“error message”})
> 
> Could you please let me know, what configuration setting of nginx could  
> cause this problem?

I would suggest that this is caused by error\_page 400 +  
proxy\_intercept\_errors configured.

Maxim D.

---

<div class="post-metadata">

**Author:** ![venkat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/4491bb/32.png) [@venkat](https://www.ruby-forum.com/u/venkat)\
**Post date:** [September 18, 2012, 9:03pm UTC](https://www.ruby-forum.com/t/nginx-modifying-the-jsonp-response-message/222976/3 "2012-09-18T21:03:33Z")

</div>

Sorry for the above post. Actually the problem is not due to nginx.

It is due to IIS 7.5 in our staging server which is causing the problem.

Below configuration change in web.config has fixed it.

\<system.webServer\>  
  
\</system.webServer\>

Thanks,  
Venkat.

Posted at Nginx Forum:

> **[Re: nginx modifying the jsonp response message](https://forum.nginx.org/read.php?2,230799,230822#msg-230822)**
>
> Hi, We are creating a web api application. In one of our API's if there are any validation errors, we are returning the error message in JSONP format. In the API Request URL user adds a query string parameter ?jsoncallback=xxxxxxxxxx. On validation...
