Top Menu

Jump to content
Home
    • Projects
    • Work packages
    • 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
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional 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?
      Create a new account

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
  • Roadmap
  • Work packages
  • Calendars
  • Team planners
  • Boards
  • Forums
  • Wiki
    • Table of contents
      • Expanded. Click to collapseCollapsed. Click to showDeveloper
        • Hierarchy leafAccessibility Checklist
        • Hierarchy leafCode Review Guidelines
        • Expanded. Click to collapseCollapsed. Click to showContribution
          • Hierarchy leafGit Workflow
          • Hierarchy leafTranslations
        • Expanded. Click to collapseCollapsed. Click to showDeveloping Plugins
          • Hierarchy leafDeveloping an OmniAuth Authentication Plugin
        • Hierarchy leafRelease Process
        • Hierarchy leafReport a bug
        • Hierarchy leafSecurity
        • Hierarchy leafSetting up an OpenLDAP server for testing
        • Hierarchy leafTheme Features
      • Hierarchy leafDownload
      • Expanded. Click to collapseCollapsed. Click to showFeature tour
        • Hierarchy leafRelease Notes OpenProject 30
        • Expanded. Click to collapseCollapsed. Click to showRelease Notes OpenProject 30 - Overview
          • Hierarchy leafGlossary
          • Hierarchy leafRelease Notes - Accessibility
          • Hierarchy leafRelease Notes - Accessibility changes
          • Hierarchy leafRelease Notes - Add work package queries as menu items to sidebar
          • Hierarchy leafRelease Notes - Copy projects based on Templates
          • Hierarchy leafRelease Notes - Design changes
          • Hierarchy leafRelease Notes - Fixed Bugs
          • Hierarchy leafRelease Notes - Keyboard Shortcuts
          • Hierarchy leafRelease Notes - Project settings
          • Hierarchy leafRelease Notes - Ruby&Rails Update
          • Hierarchy leafRelease Notes - Security
          • Hierarchy leafRelease Notes - Timelines
          • Hierarchy leafRelease Notes - Work packages
      • Hierarchy leafHowto create animated gifs
      • Hierarchy leafMigration Squashing
      • Hierarchy leafMod security
      • Hierarchy leafNew work package page
      • Hierarchy leafOP3 to OP4 Debian upgrade
      • Hierarchy leafOP4 Ubuntu1404 Stable with MySQL in production
      • Hierarchy leafOpenProject 40 Development Setup
      • Expanded. Click to collapseCollapsed. Click to showOpenProject Foundation
        • Hierarchy leafBoards
        • Hierarchy leafMembers
        • Hierarchy leafOPF-Meetings
        • Hierarchy leafStatutes
      • Expanded. Click to collapseCollapsed. Click to showRelease Notes
        • Hierarchy leafOpenProject released on Bitnami
      • Expanded. Click to collapseCollapsed. Click to showRelease Notes OpenProject 40 - Overview
        • Hierarchy leafRelease Notes OpenProject 40 - Accessibility improvements
        • Hierarchy leafRelease Notes OpenProject 40 - Column header functions in work package table
        • Hierarchy leafRelease Notes OpenProject 40 - Improved Design
        • Hierarchy leafRelease Notes OpenProject 40 - Integrated query title on work package page
        • Hierarchy leafRelease Notes OpenProject 40 - Integrated toolbar on work package page
        • Hierarchy leafRelease Notes OpenProject 40 - OmniAuth integration for OpenProject
        • Hierarchy leafRelease Notes OpenProject 40 - Work package details pane
      • Expanded. Click to collapseCollapsed. Click to showSecurity and privacy
        • Hierarchy leafFAQ
      • Expanded. Click to collapseCollapsed. Click to showSupport
        • Expanded. Click to collapseCollapsed. Click to showDownload and Installation
          • Hierarchy leafInstallation MacOS
          • Expanded. Click to collapseCollapsed. Click to showInstallation OpenProject 3 0
            • Hierarchy leafDebian Stable with MySQL in production
            • Hierarchy leafInstallation Ubuntu
            • Hierarchy leafInstallation Windows
            • Hierarchy leafInstallation on Centos 65 x64 with Apache and PostgreSQL 93
          • Expanded. Click to collapseCollapsed. Click to showInstallation OpenProject 40
            • Hierarchy leafOP4 Debian Stable with MySQL in production
          • Expanded. Click to collapseCollapsed. Click to showMigration paths
            • Hierarchy leafFrom Chilliproject to OpenProject
            • Hierarchy leafMigration 15 to 30
            • Hierarchy leafMigration 24 to 30
            • Hierarchy leafMigration Redmine 2x › OpenProject 30
            • Hierarchy leafOpenProject 3 Migration
          • Hierarchy leafOpenProject 40
        • Expanded. Click to collapseCollapsed. Click to showNews
          • Hierarchy leafNew OpenProject Translations Plugin
          • Hierarchy leafNew Plugin on OpenProjectorg Local Avatars
          • Hierarchy leafNew design for OpenProject
          • Hierarchy leafNews Accessibility workshop for OpenProject
          • Hierarchy leafNews Glossary for OpenProject
          • Hierarchy leafNews Heartbleed fixed
          • Hierarchy leafNews Icon Fonts
          • Hierarchy leafNews OpenProject 30 Release
          • Hierarchy leafNews Release GitHub Integration Plugin
          • Hierarchy leafNews Success Story Deutsche Telekom
          • Hierarchy leafNews Timelines
          • Hierarchy leafOpenProject 3013 released
          • Hierarchy leafOpenProject 3017 released
          • Hierarchy leafOpenProject 40 released
          • Hierarchy leafOpenProject 40 will be coming soon
          • Hierarchy leafOpenProject 405 released
          • Hierarchy leafOpenProject and pkgrio
          • Hierarchy leafOpenProject news moved to a new blog
          • Hierarchy leafOpenProjectBitnami
          • Hierarchy leafPackager version with plugins released ("Community edition")
          • Hierarchy leafRegistration OpenProject-Foundation
          • Hierarchy leafRelease OpenProject AuthPlugins
          • Hierarchy leafUpdates on OpenProject
          • Hierarchy leafWe need your feedback for the the new fullscreen view for work packages
        • Hierarchy leafOpenProject Plug-Ins
      • Hierarchy leafWiki
You are here:
  • Forums
  • Support Installation & Updates

Content

OpenProject Docker behind an NGINX Reverseproxy

Added by Michael Kelly over 1 year ago

Hi Guys,

we would Test OpenProject within our Company (maybe when this is successfull we switch to Enterprise) and i have a Problem:

Environment:

  • Nginx Reverseproxy (https://ngrp.com)
  • OpenProject Installation via the official Dockerhub Container (Port 8000) IP: 10.0.0.1

If i Access OpenProject directly (http://10.0.01) it works perfectly. But i must publish the Application behind the following URL for the Users:

  • https://ngrp.com/openproject

to achieve that i made the following NGINX Configuration:

  location /openproject/ {
   proxy_pass             http://10.0.0.1:8000/;
   include                /etc/nginx/conf.d/proxy.conf;
 }

But when i open the page through the Reverseproxy, the Webbrowser displays only a White Page.

In the Webbrowser Debugger i see, that some paths are wrong. Example: 

https://ngrp.com/assets/frontend/styles.c3a5e7705d6c5db9cfc1.css

but because the Subsite-Config in the NGINX it should be:

https://ngrp.com/openproject/assets/frontend/styles.c3a5e7705d6c5db9cfc1.css

So can somebody please tell me, which configuration is needed, so i can Openproject under the URL https://ngrp.com/openproject/ successfully?

Thank you very much.


Replies (12)

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by Markus Kahl over 1 year ago

Hey,

if you want to use OpenProject under a subdirectory you have to consider this both in the proxy configuration and also configure it in the environment of the container. Here's our docs section for that topic: https://www.openproject.org/docs/installation-and-operations/installation/docker/#2-location-subdirectory

You have to add the following to the container's environment:

OPENPROJECT_RAILS__RELATIVE__URL__ROOT=/openproject
OPENPROJECT_RAILS__FORCE__SSL=true

Without the first line the assets won't be found which is exactly the problem you are running into.
The second line is to ensure OpenProject uses strict transport security and secure cookies even though the requests to OpenProject itself are coming via http from the proxy.

The docs are showing the configuration for Apache but the nginx config can be derived from that.
You already have the proxy pass itself, but you should also set some headers to make sure everything works correctly:

proxy_set_header  X-Forwarded-Proto https;
proxy_set_header  X-Forwarded-Ssl on;
proxy_set_header  X-Forwarded-Host $http_host;

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by David w. about 1 year ago

Hey, 

i dont know exactly if my Problem is like yours but it sounds linke it. Im trying to run OP on my NAS with Docker and the NAS has its own Reverse Proxy System. I set up OP and im able to reach it via IP and its set Port. Now im using the Reverse Proxy from my NAS to redirect from the Web to NAS and NAS to Docker/OP. Im able to Connect to OP but every single Button i press is redirecting to the local IP:Port. I had a similar problem with my Nextcloud setup were i had to set -e OVERWRITEHOST=myURL.com. Is there anything like this in OP?

btw I can reach out to every single page by copying the IP:PORT"/path/" to the URL:PORT"/path/".

Thanks!

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by Connor Moroney about 1 year ago

I just use NGINX Proxy manager running in a separate docker.  The thing works great and pretty much does all its configuration on its own.

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by Markus Kahl about 1 year ago

David w. wrote:

Hey,

i dont know exactly if my Problem is like yours but it sounds linke it. Im trying to run OP on my NAS with Docker and the NAS has its own Reverse Proxy System. I set up OP and im able to reach it via IP and its set Port. Now im using the Reverse Proxy from my NAS to redirect from the Web to NAS and NAS to Docker/OP. Im able to Connect to OP but every single Button i press is redirecting to the local IP:Port. I had a similar problem with my Nextcloud setup were i had to set -e OVERWRITEHOST=myURL.com. Is there anything like this in OP?

btw I can reach out to every single page by copying the IP:PORT"/path/" to the URL:PORT"/path/".

Thanks!

Have you set the host name in OpenProject (Administration -> System)?

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by bret watson 7 months ago

I see the same problem as @david w. - many URLs for OP are set to absolute paths - even though they should be relatives.. eg: they are http://internal.web.server/projects/openproject/work_packages  instead of /projects/openproject/work_packages this makes it incredibly hard for a reverse proxy to deal with things.. any change of a fix?

Expanding on this - I note that "My page" is a relative link, but "My Account" is an absolute link and "Sign out" is a relative link, Links to projects are relative, but links to things like work packages etc within a project are all absolute - so frankly this is pretty shitty coding..

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by Markus Kahl 7 months ago

The fix is to configure the reverse proxy correctly.

You can find examples for reverse proxy configurations both for packaged and docker-based installations in our docs.

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by bret watson 7 months ago

I believe I have configured my proxy as per your docs... please see https://community.openproject.org/work_packages/42943#activity-3 thanks

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by Markus Kahl 7 months ago

I can see in that work package you're doing the following:

 proxy_set_header Host <internal host>;
 proxy_set_header X-Forwarded-Host $host:$server_port;
  1. Please try removing the Host header altogether, especially since it's pointing to the internal rather than the external host.
  2. Remove the port from the forwarded host (unless you access the proxy on a port other than 80), making this: proxy_set_header X-Forwarded-Host $http_host;

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by bret watson 7 months ago

I commented out proxy_set_header Host. I access the proxy on https so didn't change the server port..

No effect - the host name is still hard coded in the source page instead of relative links.. dug into the code and I can see where it is displayed, but still working out where the array is created..

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by David w. 7 months ago

I did a fresh install with Nginx Proxy Manager. My Problem was that all settings for https were reset after I requested a new ssl certificate. I had to check all boxes again and it worked. No env vars or additional settings in NginxPM. The only thing I had to do is passing the domain without "https://" into the settings tab in OP like "my.domain.org". Im using "openproject/community:12".

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by bret watson 7 months ago

Any chance of getting a copy of your nginx host config? the one in /etc/nginx/sites-available

RE: OpenProject Docker behind an NGINX Reverseproxy - Added by bret watson 7 months ago

I fixed it via sub_filter on nginx.. though this is a bandaid on some poor code..

location /openproject/ {

        proxy_set_header Accept-Encoding ""; # no compression allowed or next won't work

        sub_filter "http://<internal host>/" "https://<external host>/";
        sub_filter_once off;

        proxy_set_header Host <internal 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-Host $host:$server_port;

        proxy_pass http://<internal host>/openproject/;

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