Cee61657d2f6e04e1122f01a0c951b12d3966204
By:
farmazone

PayU notify url on https returning 502 Bad Gateway

August 23, 2016 788 views
Configuration Management Ubuntu 16.04

Hi,

In my shop, I have 3 payments methods. Braintree, Paypal and PayU. And I have a problem with PayU and https.
Here's what is happening:

  1. User buys a product with PayU and is redirected to the bank website, where he makes a payment. In an order form I have to provide a notify url for PayU.
  2. PayU asynchronously sends notifications about a payment status to a notify url (PROCESSING, COMPLETED etc.). In a notify url script I have to check the payment status and, if COMPLETED, return header("HTTP/1.1 200 OK");

Simple and it works. But not when I have ssl installed. On a domain with https the notify script causes an server error:

code (ERROR): 502, Response: "<html> <head><title>502 Bad Gateway</title></head> <body bgcolor="white"> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx</center> </body> </html> "

I don't know what to do. I have no server knowledge. Is this an server configuration issue? This is the only thing that comes to my mind. I checked my code a hundred times...

I have identical 2 websites running on the same server. One runs on https and one on http. The one on http works.

The website is build with Laravel and deployed with Forge.

Thank You.
Michał

2 comments
  • I would guess that this is a configuration issue. Since the post works on http but not on https, can you share the content of your webserver configuration for these two sites? The issue is likely a difference between these two that is preventing your script from being executed properly when it uses the https configuration.

  • Here is config file for https

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/dadastudio.pl/before/*;
    
    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name .dadastudio.pl;
        root /home/forge/dadastudio.pl/public;
    
        # FORGE SSL (DO NOT REMOVE!)
        ssl_certificate /etc/nginx/ssl/dadastudio.pl/117632/server.crt;
        ssl_certificate_key /etc/nginx/ssl/dadastudio.pl/117632/server.key;
    
        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-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_prefer_server_ciphers on;
        ssl_dhparam /etc/nginx/dhparams.pem;
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        # FORGE CONFIG (DOT NOT REMOVE!)
        include forge-conf/dadastudio.pl/server/*;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/dadastudio.pl-error.log error;
    
        error_page 404 /index.php;
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    
    
    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/dadastudio.pl/after/*;
    
    

    and for http

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/fonts.com.pl/before/*;
    
    server {
        listen 80;
        listen [::]:80;
        server_name .fonts.com.pl;
        root /home/forge/fonts.com.pl/public;
    
        # FORGE SSL (DO NOT REMOVE!)
        # ssl_certificate;
        # ssl_certificate_key;
    
        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-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_prefer_server_ciphers on;
        ssl_dhparam /etc/nginx/dhparams.pem;
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        # FORGE CONFIG (DOT NOT REMOVE!)
        include forge-conf/fonts.com.pl/server/*;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/fonts.com.pl-error.log error;
    
        error_page 404 /index.php;
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    
    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/fonts.com.pl/after/*;
    
Be the first one to answer this question.