# Bug OP-14307 - Incorrect CSP for Nextcloud storage configured with non-standard port

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-14307

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 13.3.0 |
| Observed in versions |  |
| Sprint | 13.3.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

This is mostly an issue during development with a local nextcloud instance on a non-standard port (like 8080).

1.  Have a Nextcloud instance set up on a non-standard port like 8080. To have a local Nextcloud instance, you can follow steps described in the [Nextcloud OpenProject App](https://github.com/nextcloud/integration_openproject?tab=readme-ov-file#development)
2.  Add the storage to the OpenProject instance. In my case, it was located at http://localhost:8080/
3.  Enable the storage for a project
4.  In a work package of that project, try uploading a file to Nextcloud

### What is the buggy behavior?

*   The upload fails

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/91853/content">

There are some errors in the browser js console

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/91854/content">

Error is &quot;Content-Security-Policy: The page’s settings blocked the loading of a resource at [http://localhost:8080/index.php/apps/integration\_openproject/direct-upload/xSzSDWbEc6Gw4DPYdCxH7fiMxgHAEPecLX3mt9e9c7jW4Qgb7DBDEXwCTxxEbdkH](http://localhost:8080/index.php/apps/integration_openproject/direct-upload/xSzSDWbEc6Gw4DPYdCxH7fiMxgHAEPecLX3mt9e9c7jW4Qgb7DBDEXwCTxxEbdkH) (“connect-src”).&quot;

### What is the expected behavior?

1.  The upload should work

The issue comes from the CSP which contained this:

`connect-src 'self' https://start.openproject-edge.com ws://host.docker.internal:3000 http://host.docker.internal:3000 ws://host.docker.internal:4200 http://host.docker.internal:4200 http://localhost;`

To make it work, the last url should be `http://localhost:8080` instead of `http://localhost`.

### **Logs**

### Environment information

_Please check and fill out the following details to help us identify in what versions and distributions of OpenProject the error occurs_

**OpenProject installation type**

*   [ ] Hosted cloud edition
*   [ ] Packaged installation
    *   What distribution?
*   [ ] Docker All-in-one container
*   [ ] Docker-compose installation
*   [x] Other (please specify)
    *   [x] local development, release/13.3 branch

**OpenProject version**

2024-02-12 commit 1252c5cfd8 on release/13.3 branch 

**Browser**

*   [ ] Chrome
*   [x] Firefox
*   [ ] Safari
*   [ ] Mobile Safari
*   [ ] Other (please specify)

**Language**

English
