Welcome! Log In Create A New Profile

Advanced

proxy_pass status 500 always gives 400

Posted by mailme_gx 
proxy_pass status 500 always gives 400
January 13, 2011 12:59AM
Hi All

Im replacing apache with ngix and have been truing to get it working for several hours

I m using tomcat as a backend and have 2 virtual hosts and SSL.
My first problem is that tomcat is returning a 500 "internal server error" and nginx replies with a "400 bad request"

here is my config:
[code]
user apache; # should be www or nginx
worker_processes 1;

events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

gzip on;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain application/xml application/json text/javascript text/css;

# BETA
server {
listen 80;
server_name www.beta.mydomain.com www01.beta.mydomain.com www02.beta.mydomain.com;

location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /html/beta/www/;
access_log off;
expires 30d;
}

location / {
root /html/beta/www/;
index index.html index.htm index.cfm index.cfml;
proxy_pass http://beta.localhost:8001;
# proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

# redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }

location ~ /\.svn {
deny all;
}
}

# LIVE
server {
listen 80;
server_name www.mydomain.com www01.mydomain.com www02.mydomain.com;

location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /html/live/www/;
access_log off;
expires 30d;
}

location / {
root /html/live/www/;
index index.html index.htm index.cfm index.cfml;
proxy_pass http://localhost:8001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

# redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }

location ~ /\.svn {
deny all;
}
}

# HTTPS LIVE
server {
listen 443;
server_name www.mydomain.com www01.mydomain.com www02.mydomain.com;

ssl on;
ssl_certificate cert.pem;
ssl_certificate_key server.key;

# ssl_session_timeout 5m;

ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!SSLv2:!ADH:!aNULL:!eNULL:!NULL;
# ssl_prefer_server_ciphers on;

location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /html/live/www/;
access_log off;
expires 30d;
}

location / {
root /html/live/www/;
index index.html index.htm index.cfm index.cfml;
proxy_pass http://localhost:8001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

# redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }

location ~ /\.svn {
deny all;
}
}

}

[/code]

at the moment im just testing www02.beta.mydomain.com if do a beta.localhost:8001 I get a "500 internal server" error (this is expected) but when i tri the full url I get "400 bad request"

Regards

GX



Edited 1 time(s). Last edit at 01/13/2011 01:01AM by mailme_gx.
Re: proxy_pass status 500 always gives 400
January 13, 2011 12:25PM
my bad... tomcat was the culprit..

I had a contector with various aliases that was the cause of the problem, possibly because the dns server did not resolve them, I was too lazy to put them in /etc/hosts so just added a connector for each alias instead.

now i got alot of cleaning up to do. next step try get ssl working

GX
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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