Jump to content

Edit History

Developer201343

Developer201343

Hello everyone, I have a problem with how annoying with prestashop 1.7.6.2
I have a site with 3 languages, Italian English and Spanish. I am inserting pdf attachments into the product screen.
The download doesn't work.
If I disable the languages then it works again because the language code is not present in the url. If I disable the fryend url it works, if I enable it it doesn't work.

Link: /it/index.php?controller=attachment&id_attachment=14 -> Not done
Link: /index.php?controller=attachment&id_attachment=14 -> It works

I have tried 1000 different operations with nginx but I have not been able to find a solution on the internet or anywhere else.
Some idea?

General informations:
Prestashop 1.7.6.2
Nginx server

Nginx configuration:
 

server
{
    # [REQUIRED EDIT] Your domain name goes here
    server_name site.it www.site.it;

    error_log /var/log/nginx/www.site.it-error.log;
    access_log /var/log/nginx/www.site.it-access.log;

    # [REQUIRED EDIT] Absolute path to your website root on the filesystem
    root /www/www.site.it;

    index index.php index.html;

    # to control the amount that can be uploaded.
    client_max_body_size 50M;

    # set admin folder name
    set $admin_dir /admin245tm20au; #Example: admin245tm20au

    location ~ /admin.*/(sell|api|common|_wdt|modules|improve|international|configure|addons|_profiler|product|combination|specific-price)/(.*)$ {
        try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args;
    }

    # Cloudflare / Max CDN fix
    location ~* \.(eot|otf|ttf|woff|woff2)$ {
        add_header Access-Control-Allow-Origin *;
    }

    # Do not save logs for these
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        auth_basic off;
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        # Redirect pretty urls to index.php
        try_files $uri $uri/ /index.php?$args;

        # Images
        rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
        rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
        rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
        rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

        # AlphaImageLoader for IE and fancybox
        rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

        # Web service API
        rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

    }

    # Allow access to the ACME Challenge for Let's Encrypt
    location ~ /\.well-known\/acme-challenge {
      allow all;
    }

    # Block all files with these extensions
    location ~ \.(md|tpl)$ {
      deny all;
    }

    # File security
    # .htaccess .DS_Store .htpasswd etc
    location ~ /\. {
        deny all;
    }
    # Source code directories
    location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
        deny all;
    }
    # Prevent exposing other sensitive files
    location ~ \.(yml|log|tpl|twig|sass)$ {
        deny all;
    }

    # Prevent injection of php files
    location /upload {
        location ~ \.php$ {
            deny all;
        }
    }
    location /img {
        add_header Cache-Control public;
        expires 1d;

        location ~ \.php$ {
            deny all;
        }
    }

        location ~ .php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                fastcgi_read_timeout 150;
        }




}

 

Developer201343

Developer201343

Hello everyone, I have a problem with how annoying with prestashop 1.7.6.2
I have a site with 3 languages, Italian English and Spanish. I am inserting pdf attachments into the product screen.
The download doesn't work.
If I disable the languages then it works again because the language code is not present in the url. If I disable the fryend url it works, if I enable it it doesn't work.

Link: /it/index.php?controller=attachment&id_attachment=14 -> Not done
Link: /index.php?controller=attachment&id_attachment=14 -> It works

I have tried 1000 different operations with nginx but I have not been able to find a solution on the internet or anywhere else.
Some idea?

General informations:
Prestashop 1.7.6.2
Nginx server

Nginx configuration:
 

server
{
    # [REQUIRED EDIT] Your domain name goes here
    server_name site.it www.site.it;

    error_log /var/log/nginx/www.site.it-error.log;
    access_log /var/log/nginx/www.site.it-access.log;

    # [REQUIRED EDIT] Absolute path to your website root on the filesystem
    root /www/www.site.it;

    index index.php index.html;

    # to control the amount that can be uploaded.
    client_max_body_size 50M;

    # set admin folder name
    set $admin_dir /admin245tm20au; #Example: admin245tm20au

    location ~ /admin.*/(sell|api|common|_wdt|modules|improve|international|configure|addons|_profiler|product|combination|specific-price)/(.*)$ {
        try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args;
    }

    # Cloudflare / Max CDN fix
    location ~* \.(eot|otf|ttf|woff|woff2)$ {
        add_header Access-Control-Allow-Origin *;
    }

    # Do not save logs for these
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        auth_basic off;
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        # Redirect pretty urls to index.php
        try_files $uri $uri/ /index.php?$args;

        # Images
        rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
        rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
        rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
        rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

        # AlphaImageLoader for IE and fancybox
        rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

        # Web service API
        rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

    }

    # Allow access to the ACME Challenge for Let's Encrypt
    location ~ /\.well-known\/acme-challenge {
      allow all;
    }

    # Block all files with these extensions
    location ~ \.(md|tpl)$ {
      deny all;
    }

    # File security
    # .htaccess .DS_Store .htpasswd etc
    location ~ /\. {
        deny all;
    }
    # Source code directories
    location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
        deny all;
    }
    # Prevent exposing other sensitive files
    location ~ \.(yml|log|tpl|twig|sass)$ {
        deny all;
    }

    # Prevent injection of php files
    location /upload {
        location ~ \.php$ {
            deny all;
        }
    }
    location /img {
        add_header Cache-Control public;
        expires 1d;

        location ~ \.php$ {
            deny all;
        }
    }

        location ~ .php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                fastcgi_read_timeout 150;
        }




}

 

Developer201343

Developer201343

Hello everyone, I have a problem with how annoying with prestashop 1.7.6.2
I have a site with 3 languages, Italian English and Spanish. I am inserting pdf attachments into the product screen.
The download doesn't work.
If I disable the languages then it works again because the language code is not present in the url. If I disable the fryend url it works, if I enable it it doesn't work.

Link: /it/index.php?controller=attachment&id_attachment=14 -> Not done
Link: /index.php?controller=attachment&id_attachment=14 -> It works

I have tried 1000 different operations with nginx but I have not been able to find a solution on the internet or anywhere else.
Some idea?

General informations:
Prestashop 1.7.6.2
Nginx server

Nginx configuration:
 

server
{
    # [REQUIRED EDIT] Your domain name goes here
    server_name site.it www.site.it;

    error_log /var/log/nginx/www.site.it-error.log;
    access_log /var/log/nginx/www.site.it-access.log;

    # [REQUIRED EDIT] Absolute path to your website root on the filesystem
    root /www/www.site.it;

    index index.php index.html;

    # to control the amount that can be uploaded.
    client_max_body_size 50M;

    # set admin folder name
    set $admin_dir /admin245tm20au; #Example: admin245tm20au

    location ~ /admin.*/(sell|api|common|_wdt|modules|improve|international|configure|addons|_profiler|product|combination|specific-price)/(.*)$ {
        try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args;
    }

    # Cloudflare / Max CDN fix
    location ~* \.(eot|otf|ttf|woff|woff2)$ {
        add_header Access-Control-Allow-Origin *;
    }

    # Do not save logs for these
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        auth_basic off;
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        # Redirect pretty urls to index.php
        try_files $uri $uri/ /index.php?$args;

        # Images
        rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
        rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
        rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
        rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

        # AlphaImageLoader for IE and fancybox
        rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

        # Web service API
        rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

    }

    # Allow access to the ACME Challenge for Let's Encrypt
    location ~ /\.well-known\/acme-challenge {
      allow all;
    }

    # Block all files with these extensions
    location ~ \.(md|tpl)$ {
      deny all;
    }

    # File security
    # .htaccess .DS_Store .htpasswd etc
    location ~ /\. {
        deny all;
    }
    # Source code directories
    location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
        deny all;
    }
    # Prevent exposing other sensitive files
    location ~ \.(yml|log|tpl|twig|sass)$ {
        deny all;
    }

    # Prevent injection of php files
    location /upload {
        location ~ \.php$ {
            deny all;
        }
    }
    location /img {
        add_header Cache-Control public;
        expires 1d;

        location ~ \.php$ {
            deny all;
        }
    }

        location ~ .php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                fastcgi_read_timeout 150;
        }




}

 

Developer201343

Developer201343

Hello everyone, I have a problem with how annoying with prestashop 1.7.6.2
I have a site with 3 languages, Italian English and Spanish. I am inserting pdf attachments into the product screen.
The download doesn't work.
If I disable the languages then it works again because the language code is not present in the url. If I disable the fryend url it works, if I enable it it doesn't work.

Link: /it/index.php?controller=attachment&id_attachment=14 -> Not done
Link: /index.php?controller=attachment&id_attachment=14 -> It works

I have tried 1000 different operations with nginx but I have not been able to find a solution on the internet or anywhere else.
Some idea?

General informations:
Prestashop 1.7.6.2
Nginx server

×
×
  • Create New...