Welcome! Log In Create A New Profile

Advanced

My configuration is wrong, where is the mistake?

Posted by Paul6552 
My configuration is wrong, where is the mistake?
June 07, 2021 05:53AM
I am using nginx 1.18.0. This is my configuration:

*****************************************************************************************************************************
#Nginx is taking everytime the first serverblock if no other block fits.
#Therefor we have this default-block: (server_name '_') + default_server returns 444 means "NO RESPONSE".
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 444;
}

#This is the catch-block for all ssl-connections. This block only works from version 1.20. Until we upgraded to this version we leave this #uncomment
#server {
# listen 443 ssl;
# listen [::]:443 ssl;
# ssl_reject_handshake on;
#}

# redirect all traffic to https if the domain is mydomain.at (server_name)
server {
listen 80;
listen [::]:80;
server_name mydomain.at;
return 301 https://$host$request_uri;
}


#server_name is set to mydomain.at. That means that only requests from THIS DOMAIN are coming through.
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

root /config/www;
index index.html index.htm index.php;

server_name mydomain.at;

# enable subfolder method reverse proxy confs
include /config/nginx/proxy-confs/*.subfolder.conf;

# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;

# enable for geo blocking
# See /config/nginx/geoip2.conf for more information.
#if ($allowed_country = no) {
#return 444;
#}

client_max_body_size 0;

error_page 404 =200 /portal;

#add_header Access-Control-Allow-Origin http://example.org;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN";

location = / {
return 301 https://mydomain.at/portal;
#try_files $uri $uri/ /index.html /index.php?$args =404;
}

location /server1 {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/server1;

# do not pass the CORS header from the response of the proxied server to the
# client
#proxy_hide_header 'Access-Control-Allow-Origin';
}

location /portal {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8180/portal;
}

location /auth {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8280/auth;
}
}
*****************************************************************************************************************************

But anything is wrong, because I get response coming through nginx like this and the log report from the server behind are showing messages like this:

*****************************************************************************************************************************
ERROR [io.und.request] (executor-thread-55) UT005071: Undertow request failed HttpServerExchange{ POST http://check.best-proxies.ru/azenv.php delegate io.undertow.vertx.VertxHttpExchange@85feee5}:

ERROR [io.und.req.io] (executor-thread-26) Exception handling request ced982ff-6ee1-4496-aad4-8043edcc8856-19 to /index.jsp: java.lang.IllegalStateException: Unsupported HTTP version: HTTP/0.9

ERROR [io.und.request] (executor-thread-6) UT005071: Undertow request failed HttpServerExchange{ HEAD http://112.124.42.80:63435/ delegate io.undertow.vertx.VertxHttpExchange@7140873e}:
*****************************************************************************************************************************


Can someone pls explain me why my configuration is wrong?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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