Override Content-Type header with proxied requests

Wandenberg Peixoto wandenberg at gmail.com
Thu Aug 7 04:10:22 UTC 2014


Hello,

you can use many values on the map, take a look on its docs.
One quickly example may be (not tested)

map $uri $custom_content_type {
    default         "text/html";
    ~(.*\.json)$  "application/json";
}

location ~ \.json$ {
    proxy_hide_header Content-Type;
    add_header Content-Type $custom_content_type;

    # other proxy configurations like proxy_pass
}

Or try to use the types {} directive which is specific to make the
relationship between extensions and content-type.



On Thu, Aug 7, 2014 at 12:14 AM, manish-ezest <nginx-forum at nginx.us> wrote:

> Hello All,
>
> Can somebody answer this question? I am facing this issue from many days.
>
> --Manish
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,252360,252378#msg-252378
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140807/6dc770c4/attachment-0001.html>


More information about the nginx mailing list