Any Request made from API client to server giving 302 for exmaple https://app.ardracloud.com/api/deviceconnect or http://app.ardracloud.com/api/deviceconnect returns 302
server { listen 66.66.66.66:443 ssl; listen 443; listen [::]:443; server_name app.ardracloud.com; server_name www.app.ardracloud.com; server_name ipv4.app.ardracloud.com; ssl_certificate /opt/psa/var/certificates/******; ssl_certificate_key /opt/psa/var/certificates/******; client_max_body_size 134217728; access_log "/var/www/vhosts/system/app.ardracloud.com/logs/proxy_access_ssl_log"; error_log "/var/www/vhosts/system/app.ardracloud.com/logs/proxy_error_log"; root "/var/www/vhosts/ardracloud.com/app.ardracloud.com/public"; #Error Handling error_page 497 https://$host:$server_port$request_uri; error_page 400 https://app.ardracloud.com:443$request_uri; location ^~ /.well-known/acme-challenge/ { root /var/www/vhosts/default/htdocs; types { } default_type text/plain; satisfy any; auth_basic off; allow all; location ~ ^/\.well-known/acme-challenge.*/\. { deny all; } } #extension letsencrypt end location / { proxy_read_timeout 1200s; proxy_pass https://127.0.0.1:7081/; #proxy_hide_header upgrade; 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-Accel-Internal /internal-nginx-static-location; access_log off; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_redirect http://127.0.0.1:7081/ https://app.ardracloud.com/; } location ^~ /internal-nginx-static-location/ { alias /var/www/vhosts/ardracloud.com/app.ardracloud.com/public/; internal; } location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) { proxy_pass https://127.0.0.1:7081; proxy_hide_header upgrade; 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-Accel-Internal /internal-nginx-static-location; access_log off; } disable_symlinks if_not_owner "from=/var/www/vhosts/ardracloud.com"; add_header X-Powered-By PleskLin; } map $upstream_http_location $redirect_uri { "~https://[^/]+/(?<location_uri>.*)$" "$location_uri"; } upstream origin { server app.ardracloud.com; } server { listen 66.66.66.66:80; server_name app.ardracloud.com; server_name www.app.ardracloud.com; server_name ipv4.app.ardracloud.com; client_max_body_size 134217728; access_log "/var/www/vhosts/system/app.ardracloud.com/logs/proxy_access_log"; error_log "/var/www/vhosts/system/app.ardracloud.com/logs/proxy_error_log"; location / { return 301 https://$host$request_uri; } location /api { return 301 https://$host$request_uri; } } @Richard Smit - The Curl -I response
HTTP/1.1 301 Moved Permanently Server: nginx Date: Sun, 18 Feb 2024 10:39:57 GMT Content-Type: text/html Content-Length: 162 Connection: keep-alive Location: https://app.ardracloud.com/ @Richard Smit - The Curl -I response HTTP/1.1 301 Moved Permanently Server: nginx Date: Sun, 18 Feb 2024 10:39:57 GMT Content-Type: text/html Content-Length: 162 Connection: keep-alive Location: https://app.ardracloud.com/
curl -Ito test your server. Currently, the first URL is returning a 404 status from some PHP script, and the second is returning a 301 status as expected.serverblock, which contains tworeturn 301statements.