magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Setting up Magento using reverse proxy #39351

Open princessfrombabylon99 opened 3 hours ago

princessfrombabylon99 commented 3 hours ago

Preconditions and environment

Steps to reproduce

Magento works fine, if I use a sub-domain and let's encrypt certifcate. Due to some requirements, I want to communicate with Magento via Private-IP. Below are my NGINX configurations of both servers , The Magento server seems to force for SSL certificate even inside the same VPC using private IP.
Frappe(ec2-instance) Server Block Configuration

server {
    listen 80;
    server_name mydomain.com;

    location /shop {
        proxy_pass http://<private-ip-of-other-server>;
        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-Forwarded-Proto $scheme;
    }
}

Magento Server Block Configuration

upstream fastcgi_backend {
  server  unix:/run/php/php8.3-fpm.sock;
}

server {
  server_name <private-ip-of-server>;
  set $MAGE_ROOT /var/www/html/magento2;
  include /var/www/html/magento2/nginx.conf.sample;
    }

video6154492151515321014-ezgif com-video-to-gif-converter

Magento’s Base URL Configuration

bin/magento config:set web/unsecure/base_url http://mydomain.com/shop/
bin/magento config:set web/secure/base_url https://mydomain.com/shop/

Unsecure Base URL for Static Files: bin/magento config:set web/unsecure/base_static_url http://mydomain.com/shop/static/ Secure Base URL for Static Files: bin/magento config:set web/secure/base_static_url https://mydomain.com/shop/static/

Unsecure Base URL for Media: bin/magento config:set web/unsecure/base_media_url http://mydomain.com/shop/media/ Secure Base URL for Media: bin/magento config:set web/secure/base_media_url https://mydomain.com/shop/media/

Expected result

Should be able to view Magento's homepage @ mydomain.com/shop without any issues.

Actual result

image

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 3 hours ago

Hi @princessfrombabylon99. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.