I
I
Ivan Ilyasov2019-01-20 15:03:34
Nginx
Ivan Ilyasov, 2019-01-20 15:03:34

Site on http/2. How to open certain pages via http/1.1?

I've searched all over Google and found nothing.
In general, http/2 is configured.
Task :
Open certain pages (starting with https://site.ru/somepage/) via http/1.1 protocol

config
server {
    listen      ip_address:443 ssl http2;
    server_name site.ru www.site.ru;
    ssl         on;
    add_header Strict-Transport-Security "max-age=31536000;" always;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_certificate      /home/admin/conf/web/ssl.sit.ru.pem;
    ssl_certificate_key  /home/admin/conf/web/ssl.site.ru.key;
    error_log  /var/log/apache2/domains/site.ru.error.log error;
}
What for? http/2 has a problem opening files on iPhone in Safari browser. On http1.1 everything works, on http2 it doesn't.
I transfer files through php like this
header('Content-Description: File Transfer');
        header('Content-Transfer-Encoding: binary');
        header('Content-Type: application/epub+zip');
        header('Content-Length: '.filesize($file));
        header('Content-Disposition: attachment; filename="'.$filename.'"');
        // force to disable caching
        header("Cache-Control: no-cache, no-store, max-age=0, must-revalidate"); // HTTP/1.1
        header("Pragma: no-cache"); // For old clients http/1.0
        header("Expires: -1"); // ensure that clients immediately treat this response as stale and avoid caching
  header("X-XSS-Protection: 1; mode=block");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Syomov, 2019-01-20
@IvanIlyasov

In nginx, at the location level, it is impossible to select a protocol, only at the level of the entire virtual host (in fact, even the port, if not fixed yet). So, either fall back completely to http 1.1, or put up with the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question