Welcome! Log In Create A New Profile

Advanced

nginx as reverse proxy to apache with drupal, adding strange string to 404 pages

Posted by ShaiWwW 
nginx as reverse proxy to apache with drupal, adding strange string to 404 pages
January 31, 2011 03:30PM
Hi,

I setup nginx as reverse proxy for apache running drupal... something strange - when there is 404 page seems like nginx adds string on beginning of the request and the end:
"5d9e" (changing by url I try) on the begin and.
and string "0" in the end - it adds around the HTML.

the config of the proxy:


[code]
...
include mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
keepalive_timeout 7;
open_file_cache max=1000;
gzip on;
gzip_types application/javascript application/x-javascript text/css text/xml application/xml;
proxy_cache_path /srv/www/nginx/cache levels=1:2 keys_zone=cache:60m max_size=1000m inactive=600m;
proxy_temp_path /srv/www/nginx/tmp/;
client_body_buffer_size 1m;
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 32k;
server_tokens off;
server {
listen 80;
server_name www.example.com ~^.+$;
location / {
proxy_pass http://backend_apache2:8081;
#proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache cache;
proxy_cache_bypass $cookie_NO_CACHE;
proxy_no_cache $cookie_NO_CACHE;
proxy_cache_key $host$request_uri;
proxy_cache_valid 4h;
#proxy_cache_valid 302 301 4h;
#proxy_cache_valid any 1m;
proxy_cache_valid 500 501 502 503 1m;
proxy_ignore_headers Cache-Control Expires;
proxy_pass_header Set-Cookie;
#proxy_pass_header X-Accel-Expires;
}

...

[/code]
Re: nginx as reverse proxy to apache with drupal, adding strange string to 404 pages
January 31, 2011 05:57PM
i see http/1.0 in the apache access log
so this is kind of strange

will try to use sniffer ... and see what is really going on :)
Re: nginx as reverse proxy to apache with drupal, adding strange string to 404 pages
January 31, 2011 06:20PM
even if I see in the log HTTP/1.0
apache is still replying with HTTP/1.1
and so far I couldn't make it answer with HTTP/1.1 for nginx proxying.. any suggest will be great.

sniffing result:

[code]
GET /asdhadjhhjjhjhjhjh HTTP/1.0
Host: www.example.com
X-Forwarded-For: my.real.ip.here
X-Real-IP: my.real.ip.here
Connection: close
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: SomeCookiesHere


HTTP/1.1 404 Not Found
Date: Mon, 31 Jan 2011 23:03:06 GMT
Server: Apache
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Mon, 31 Jan 2011 23:03:06 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
- why is this added to response? when I request from backend directly I dont get this...
594a
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

[/code]

I already tried to use - proxy_set_header Accept-Encoding "";
without much success..

Thanks
Re: nginx as reverse proxy to apache with drupal, adding strange string to 404 pages
January 31, 2011 06:48PM
OK

Solved (I think and also hope it won't cause other problems)

added to Apache's config -
[code]
SetEnv force-response-1.0
[/code]

and now it answers nginx' HTTP/1.0 requests with HTTP/1.0 responses


good night



Edited 2 time(s). Last edit at 01/31/2011 06:49PM by ShaiWwW.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
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