Welcome! Log In Create A New Profile

Advanced

Re: Override Content-Type header with proxied requests

August 09, 2014 11:36PM
I wrote a module to process the problem ena.https://github.com/flygoast/ngx_http_types_filter

our configuration in production like this:
location / {
types_filter $uri;
......
proxy_pass http://down_server;
}
At 2014-08-09 10:34:06,manish-ezest <nginx-forum@nginx.us> wrote:
>Hello Wandenberg,
>
>Yes, the back-end(s3 bucket) is sending Content-Type header for each request
>and what I heard from the developers that the header is must for the site to
>work properly.
>
>The issue started when I got the request of enabling content-type header of
>all the json files to application/json. As the default content-type in NGINX
>is application/octet-stream, the JSON files are served as
>application/octet-stream. The jquery uses content-type header to identify
>the JSOn files and due to the application/octet-stream content type it is
>not able to identify the JSOn files.
>
>I tried many options but each time one of the features(html files got
>downloaded, CSS not loaded, CSS problem in internet explorer) got impacted.
>
>I will try adding all the mime types to the map directive and will let you
>know the result.
>
>Here is my nginx.conf and vhost file for your reference
>
>**************my NGINX.conf********************
> user nginx;
> worker_processes 1;
> error_log /var/log/nginx/error.log notice;
> pid /var/run/nginx.pid;
> worker_rlimit_nofile 30000;
> events {
> worker_connections 1024;
> }
> http {
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
>
> log_format main '$remote_addr - $remote_user [$time_local] $request '
> '"$status" $body_bytes_sent "$http_referer" '
> '"$http_user_agent" "$http_x_forwarded_for"';
> log_format combined_time '$remote_addr - $remote_user [$time_local]'
> '"$request" $status $body_bytes_sent '
> '"$http_referer" "$http_user_agent" $request_time';
>
> access_log /var/log/nginx/access.log combined_time;
> include /etc/nginx/servers/*.conf;
> }
> **********************************************
>
> ******************************VHOST SETTING*****
> server {
> listen 80;
> server_name www-aaa.com;
> add_header Cache-Control off;
> expires 1d;
> root /var/empty;
> error_log /var/log/nginx/www.aaa.com-error.log;
> access_log /var/log/nginx/www.aaa.com-access.log
> combined_time;
> location = /favicon.ico {
> root /www;
> }
> proxy_intercept_errors on;
> error_page 400 401 402 403 404 406 407 408 409 410 411 412 413 414 415 416
> 417 495 496 497 500 501 502 503 504 505 506 507 = /error_page.pl;
> error_page 405 =200 $uri;
> location /error_page.pl {
> fastcgi_pass 127.0.0.1:8999;
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_pass_header "Status";
> }
>
> location / {
> proxy_redirect off;
> proxy_set_header Host www.aaa.com.s3.amazonaws.com;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Referer www.aaa.com;
> proxy_pass http://www.aaa.com.s3.amazonaws.com/;
> add_header Access-Control-Allow-Origin *;
> }
> }
>
>Posted at Nginx Forum: http://forum.nginx.org/read.php?2,239473,252439#msg-252439
>
>_______________________________________________
>nginx mailing list
>nginx@nginx.org
>http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Override Content-Type header with proxied requests

andrea.mandolo May 23, 2013 11:07AM

Re: Override Content-Type header with proxied requests

Jonathan Matthews May 23, 2013 11:12AM

Re: Override Content-Type header with proxied requests

António P. P. Almeida May 23, 2013 11:26AM

Re: Override Content-Type header with proxied requests

António P. P. Almeida May 23, 2013 11:34AM

Re: Override Content-Type header with proxied requests

manish-ezest August 06, 2014 08:18AM

Re: Override Content-Type header with proxied requests

andrea.mandolo May 24, 2013 04:58AM

Re: Override Content-Type header with proxied requests

wandenberg August 07, 2014 12:12AM

Re: Override Content-Type header with proxied requests

manish-ezest August 07, 2014 11:57AM

Re: Override Content-Type header with proxied requests

wandenberg August 07, 2014 01:58PM

Re: Override Content-Type header with proxied requests

manish-ezest August 07, 2014 02:17PM

Re: Override Content-Type header with proxied requests

manish-ezest August 07, 2014 02:30PM

Re: Override Content-Type header with proxied requests

manish-ezest August 08, 2014 09:23AM

Re: Override Content-Type header with proxied requests

wandenberg August 08, 2014 11:44AM

Re: Override Content-Type header with proxied requests

manish-ezest August 08, 2014 10:34PM

Re: Override Content-Type header with proxied requests

manish-ezest August 13, 2014 06:18AM

Re: Override Content-Type header with proxied requests

flygoast August 09, 2014 11:36PM

Re: Override Content-Type header with proxied requests

Pavel Vasev May 24, 2015 07:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready