[bug]: Import/Export plugin returns 401 Unauthorized on Strapi behind Apache proxy with HTTPS

Aperta
#106 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
aws, typescript, ubuntu

Direzione di ricerca

Start by reproducing the POST request to /strapi-import-export/export/contentTypes through the Apache HTTPS proxy and inspect the browser's 401 response. Compare the request's credentials and proxy behavior with a direct Strapi request, then verify that the export completes and JSON is returned to the frontend.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

issue: bug
What version of @strapi/sdk-plugin are you using?

Describe the bug

I am trying to use the Strapi Import/Export plugin (https://market.strapi.io/plugins/strapi-import-export) on Strapi v4 running behind an Apache reverse proxy with HTTPS on AWS EC2.
Whenever I try to export content types, I get the following error in the browser console:

What's Wrong?

POST https://strapi.dev2.mybrainguide.org/strapi-import-export/export/contentTypes
401 (Unauthorized)
FetchError: Missing or invalid credentials

The plugin never completes the export and the frontend shows "fetching data" indefinitely.


Steps to reproduce

  1. Deploy Strapi v4 on Ubuntu AWS EC2.
  2. Configure Apache as a reverse proxy:

HTTP virtual host (*:80)

<VirtualHost *:80>
ServerName strapi.dev2.mybrainguide.org
RewriteEngine on
RewriteCond %{SERVER_NAME} =strapi.dev2.mybrainguide.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

HTTPS virtual host (*:443)
<VirtualHost *:443>
ServerName strapi.dev2.mybrainguide.org

bash
Copy code
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/strapi.dev2.mybrainguide.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/strapi.dev2.mybrainguide.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:1337/ retry=0
ProxyPassReverse / http://localhost:1337/
ProxyTimeout 300

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
```
Log into Strapi admin panel over HTTPS.

Go to the Import/Export plugin.

Attempt to export any collection type.

Expected behavior

To Reproduce

current package.json

root@ip-10-0-0-9:/var/www/html/server# cat package.json { "name": "server", "version": "0.1.0", "private": true, "description": "A Strapi application", "scripts": { "build": "strapi build", "console": "strapi console", "deploy": "strapi deploy", "dev": "strapi develop", "develop": "strapi develop", "start": "strapi start", "strapi": "strapi", "upgrade": "npx @strapi/upgrade latest", "upgrade:dry": "npx @strapi/upgrade latest --dry" }, "dependencies": { "@strapi/plugin-cloud": "5.30.0", "@strapi/plugin-users-permissions": "5.30.0", "@strapi/strapi": "5.30.0", "better-sqlite3": "11.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "react-router-dom": "^6.0.0", "strapi-import-export": "^0.0.1", "styled-components": "^6.0.0" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "typescript": "^5" }, "engines": { "node": ">=18.0.0 <=22.x.x", "npm": ">=6.0.0" }, "strapi": { "uuid": "0d97aaa9-f5cb-4da5-9eaf-3a3e1f45d059", "installId": "81c015dacec498d279a8ac3d91d17ef22665ff5fef58580289962fc0bf063d12" } }

I am following your below documents
https://market.strapi.io/plugins/strapi-import-export

Expected Behaviour

Content types should export successfully, and JSON should be returned to the frontend.

Lingua principale
TypeScript
Stelle
24
Fork
13
Merge medio
5g 3h
PR unite (30g)
5

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di strapi/sdk-plugin

Tutte le issue di strapi/sdk-plugin

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.