is it possible to rewrite or redirect NGINX HTTPS url to APACHE HTTP url from the front end request? My website is using Nginx web server, but all the others files is in storage server with Apache as it's webserver. Whenever there are any request for files with certain format, it will rewrite to mydomain.com and it's path. This configuration works with NGINX HTTP to APACHE HTTP, bu now, when it turn NGINX HTTPS, it's not working. I couldn't figure what's are the issue here?
log_format main '$remote_addr - $remote_user [$time_local] $status '
'$ssl_protocol/$ssl_cipher '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/www/html/access.log main;
error_log /var/www/html/error.log;
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate /etc/ssl/certs/example.crt;
ssl_certificate_key /etc/ssl/private/exacmple.key;
root /var/www/html;
index index.php index.html;
location ~ (.*)\.pdf$ {
rewrite ^(.*)$ http://mydomain.xy$1 redirect;
}
location ~ "^/photos/(.*)" {
rewrite ^(.*)$ "http:/mydomain.xy$1" redirect;
}
location ~ (.*)\.xls$ {
rewrite ^(.*)$ http://mydomain.xy$1 redirect;
}
location ~ (.*)\.zip$ {
rewrite ^(.*)$ http://mydomain.xy$1 redirect;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
proxy_pass http://127.0.0.1:8080;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name www.example.com;
return 301 https://$host$request_uri;
}