Почему я не могу соединиться со своим веб-сайтом в HTTP с помощью завихрения?

У меня есть веб-сайт www.eshipp.com, весь домен защищается SSL, таким образом, любой Трафик HTTP перенаправляется NGINX к HTTPS эквивалентный URL.

Однако кажется, что некоторые пользователи не перенаправляются и затем получение "не доступной" ошибки HTTP.

Поскольку у меня нет ошибки самого на браузере, который трудно отладить, но я к счастью нашел, что использование Завихрения совершает эту ошибку, произойдите:

$ curl -v http://eshipp.com/
* Hostname was NOT found in DNS cache
*   Trying 198.199.96.110...
* connect to 198.199.96.110 port 80 failed: Connection timed out
* Failed to connect to eshipp.com port 80: Connection timed out
* Closing connection 0
curl: (7) Failed to connect to eshipp.com port 80: Connection timed out

Команда выше не работает, но та ниже работ:

curl -v https://eshipp.com/

* Hostname was NOT found in DNS cache
*   Trying 198.199.96.110...
* Connected to eshipp.com (198.199.96.110) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
*        subject: OU=Domain Control Validated; OU=Gandi Standard SSL; CN=eshipp.com
*        start date: 2015-07-13 00:00:00 GMT
*        expire date: 2016-07-13 23:59:59 GMT
*        subjectAltName: eshipp.com matched
*        issuer: C=FR; ST=Paris; L=Paris; O=Gandi; CN=Gandi Standard SSL CA 2
*        SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: eshipp.com
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server nginx is not blacklisted
< Server: nginx
< Date: Sat, 08 Aug 2015 22:10:56 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Strict-Transport-Security: max-age=31536000; includeSubdomains
< 
<!DOCTYPE html>

Вот конфигурация NGINX:

# HTTP
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name www.eshipp.com eshipp.com;
        return 301 https://$server_name$request_uri;
}

# HTTPS
server {
        listen 443 ssl spdy;
        server_name www.eshipp.com eshipp.com;
        keepalive_timeout 10m;

        # Certificats SSL
        ssl_certificate /etc/nginx/ssl/eshipp.com.crt;
        ssl_certificate_key /etc/nginx/ssl/eshipp.com.key;

        # Amélioration des performances SSL
        ssl_stapling on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;

        # Amélioration de la sécurité SSL
        ssl_prefer_server_ciphers on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SH$

        # Active le HSTS to avoid SSL stripping
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

        # If your application is not compatible with IE <= 10, this will redirect visitors to a page advising a browser update
        # This works because IE 11 does not present itself as MSIE anymore
        if ($http_user_agent ~ "MSIE" ) {
                return 303 https://browser-update.org/update.html;
        }

        location / {
                proxy_pass http://127.0.0.1:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade; # allow websockets
                proxy_set_header Connection $connection_upgrade;
                proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP

                # this setting allows the browser to cache the application in a way compatible with Meteor
                # on every application update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 da$
                # the root path (/) MUST NOT be cached
                if ($uri != '/') {
                        expires 30d;
                }
        }
}

Править

Хорошо я нашел, что, проблема возникает из правила в Брандмауэре, но я не знаю, какой блокирует Трафик HTTP, кто-то мог помочь мне?

# INPUT rules
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -m limit --limit 50/second --limit-burst 50 -j ACCEPT
iptables -A INPUT -p icmp -m limit --limit 1/sec -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -m state --state NEW -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP

РЕДАКТИРОВАНИЕ 2

Я должен был добавить это правило разблокировать трафик, но это - проблема, потому что я не хочу выставлять порт 3000 в Интернете, это используется только в локальном приложением NodeJS.. Я попробовал -i lo но это не работает..

iptables -A INPUT -i eth0 -p tcp --dport 3000 -j ACCEPT
0
задан 9 August 2015 в 03:40
1 ответ

Причина, по которой ваша команда CURL не работает, заключается в том, что вы не следуете перенаправлениям: http://curl.haxx.se/docs/faq.html#How_do_I_tell_curl_to_follow_HTT

Попробуйте: curl -Lv http://eshipp.com/

Глядя на правила вашей IP-таблицы, вы довольно агрессивно ограничиваете скорость соединений до 443 и 80. Это может быть причиной некоторых ваших клиентов не могут собирать данные.

Кроме того, в этих 2 правилах вы разрешаете только НОВОЕ соединение (и ограничиваете их скорость). Я предлагаю вам изменить их. для включения ESTABLISHED, а также NEW.

iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 50 / minute --limit-burst 200 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -m state --state NEW -m limit --limit 50 / minute --limit-burst 200 -j ACCEPT

изменить - указать NEW на - указать NEW, ESTABLISHED

FWIW: Мне удалось скрутить URI очень хорошо

И дополнительная информация, поддержка SPDY удалить с помощью Google, поскольку его функциональность встроена в HTTP / 2 http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html

3
ответ дан 4 December 2019 в 12:26

Теги

Похожие вопросы