-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:adminSource is core/admin packageSource is core/admin packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Description
Bug report
Describe the bug
There is a hard coded /admin/init path that doesn't use the proxy settings leading to a failure to connect under certain types of proxying.
strapi/packages/strapi-admin/admin/src/containers/App/index.js
Lines 57 to 60 in 4add565
| try { | |
| const { data } = await request('/admin/init', { method: 'GET' }); | |
| const { uuid } = data; |
Steps to reproduce the behavior
Attempt to set a proxying config where Strapi doesn't serve the Admin panel is instead the proxy application tries to serve it from the Strapi root such as:
server {
# Listen HTTP
listen 80;
server_name strapi.guru;
# Static Root
location / {
root /var/www/html;
}
# Client 1
location /client-01/api/ {
rewrite ^/client-01/api/(.*)$ /$1 break;
proxy_pass http://client1;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $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;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass_request_headers on;
}
# This right here is a symlink of the build folder into the /var/www/html folder, assuming the request should be to
# http://strapi.guru/client-01/init and not http://strapi.guru/client-01/admin/init
location /client-01/ {
root /var/www/html;
}
}
See the following server.js file for example:
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: env('NGINX_URL', 'http://strapi.guru/client-01'),
admin: {
serveAdminPanel: false,
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
},
});Expected behavior
Admin should be using the proxy settings and adjusting this request
Screenshots
System
- Node.js version: v14
- NPM version: v6
- Strapi version: 3.2.1
- Database: PostgreSQL
- Operating system: Ubuntu 18.04
noticeeverything, Jer1911, mckn, twobit, mattpilott and 20 moreborm, mattpilott and rroslaniec
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundIf it breaks the basic use of the product but can be worked aroundsource: core:adminSource is core/admin packageSource is core/admin packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members


