Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@dineshpithiya-virtusa

Description

@dineshpithiya-virtusa
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugIssue reporting a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.