Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

General discussion
  1. OpenProject
  2. Forums
  3. General discussion
  4. Problem with "Content Security Policy" directive

Problem with "Content Security Policy" directive

Added by Federico Rodriguez over 6 years ago

When i save a change in the site, in javascript appears console this error:

Refused to send form data to 'http://openproject.mydomain/' because it violates the following Content Security Policy directive: "form-action 'self'".

How can I solve it?


Replies (12)

RE: Problem with "Content Security Policy" directive - Added by Federico Rodriguez over 6 years ago

My openproject-le-ssl.conf file:

 
<VirtualHost *:443> 
 ServerName xxxxxxxxxxxxxxxxxxxxxxxxxx
 DocumentRoot /opt/openproject/public 

 ProxyRequests off 

 Include /etc/openproject/addons/apache2/includes/vhost/*.conf 

 # Can't use Location block since it would overshadow all the other proxypass directives on CentOS 
 ProxyPass / http://127.0.0.1:6000/ retry=0 
 ProxyPassReverse / http://127.0.0.1:6000/ 

SetEnv proxy-nokeepalive 1 
RequestHeader set X-Forwarded-Proto "https" 
Header unset X-Frame-Options 
Header merge Cache-Control no-cache 
Header set Access-Control-Allow-Origin “*” 
SSLCertificateFile /etc/letsencrypt/live/trepcom.data.com.uy/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/trepcom.data.com.uy/privkey.pem 
Include /etc/letsencrypt/options-ssl-apache.conf 
 

RE: Problem with "Content Security Policy" directive - Added by Juan Gimenez over 6 years ago

Hi, i have the same problem, where you able to solve this ? 

Thanks

RE: RE: Problem with "Content Security Policy" directive - Added by Martin Finkenflügel over 6 years ago

I ran into the same problem.

The solution was to set the correct protocol in your systems settings. Mine was set to http although my nginx config forced OpenProject to use https. Switching the protocol to https instead of http fixed it.

RE: Problem with "Content Security Policy" directive - Added by Oliver Günther over 6 years ago

Thanks Martin for the information. Since the packaged installation would set the protocol automatically only for Apache installations, I can see that with Nginx users tend to run into this problem.

I'll look into documenting this option better in case of skipping Apache installation. In short, when installing with Nginx (or manually embedding in Apache), you will want to set the following variables manually:

openproject config:set SERVER_HOSTNAME=yourdomain.example
openproject config:set SERVER_PROTOCOL=https # when you use TLS or proxy with X-Forwarded-Proto

Best,

Oliver

RE: Problem with "Content Security Policy" directive - Added by Martin Finkenflügel over 6 years ago

Hi Oliver,

No problem!

Wouldn't it be possible to automate this for nginx users as well? Seeing as the example hostname does already suggest the correct hostname.

I'm running the Docker image by the way, on a webserver which has nginx installed.

RE: Problem with "Content Security Policy" directive - Added by Oliver Günther over 6 years ago

Hi Martin,

yes, it is definitely possible to automate that, but would also increase complexity on our packages to support multiple vendors.

Best,

Oliver

RE: Problem with "Content Security Policy" directive - Added by Martin Finkenflügel over 6 years ago

Update:

Problem returned after upgrading. Also adding this line to my nginx configuration (as mentioned here) seems to have solved it: 

proxy_set_header X-Forwarded-Proto $scheme;

RE: Problem with "Content Security Policy" directive - Added by Sascha Nonn about 6 years ago

I had the same issue, I couldn't login due to the error of not sending form data to http addresses. Finally I solved the problem by altering the database:

mariadb; update settings set value = "https" where value = "http";

Before this, I did the configs, added the proxy header, recompiled the assets afterwards and restarted the server, nothing helped, but this. Good luck everybody.

RE: Problem with "Content Security Policy" directive - Added by Oliver Günther about 6 years ago

This might be connected to the following bug report: . If wrote it earlier in this thread but if you had configured Apache2 at any earlier time in the installation, your environment config will still contain a reference to SERVER_HOSTNAME . You will want to set this env manually with openproject config:set SERVER_HOSTNAME="https" to ensure it will survive upgrades.

Best,

Oliver

RE: Problem with \"Content Security Policy\" directive - Added by Sascha Nonn about 6 years ago

Oliver Günther wrote:

This might be connected to the following bug report: . If wrote it earlier in this thread but if you had configured Apache2 at any earlier time in the installation, your environment config will still contain a reference to SERVER_HOSTNAME . You will want to set this env manually with openproject config:set SERVER_HOSTNAME=\"https\" to ensure it will survive upgrades.

I guess you mean SERVER_PROTOCOL?

RE: Problem with "Content Security Policy" directive - Added by Oliver Günther about 6 years ago

You're right, thanks for spotting. The SERVER_HOSTNAME however is also affected in the same fashion.

RE: Problem with "Content Security Policy" directive - Added by Graham Higgins about 6 years ago

Hi,

I'm seeing a similar issue. I'm using an evaluation version of the Cloud product. Is there a was to configure this for the Cloud version ?

I'm trying to load the UI into an iframe.

Thanks

Graham

  • (1 - 12/12)
Loading...