Local deployment - webproxy

As nobody seems to pick up my problem described in MFE - ALLOWED_HOSTS error, about getting MFE to work, here maybe a simpler way to describe it:

Citing from the documentation Local deployment — Tutor documentation

As an example, here is how to launch two different platforms, with nginx running as a web proxy:
sudo ln -s "$(tutor config printroot)/env/local/proxy/nginx/openedx.conf" /etc/nginx/sites-enabled/site1.conf

Well, there is no openedx.conf file anymore to be found, so I have no example of a webproxy config file where supposedly MFE should work.

Could you please provide some working nginx (or apache) conf file for a webproxy, with MFE working?

I solved my problem with the following plugin:

name: mfe_nginx_extra
version: 0.1.0
  nginx-extra: |
    # MFE
    upstream mfe-backend {
      server mfe:8002 fail_timeout=0;
    server {
      listen 80;
      server_name {{ MFE_HOST }};

      # Disables server version feedback on pages and in headers
      server_tokens off;

      client_max_body_size 10m;

      location / {
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://mfe-backend;

Would be nice if the tutor-mfe/tutormfe/patches directory had a nginx-extra file with this configuration :slight_smile:

I find your comment very unfair, as two different users did try to help you and answered your initial topic.

There appears to be a bug in the docs. I opened a PR to address this: fix: don't refer to obsolete proxy config in docs by regisb · Pull Request #462 · overhangio/tutor · GitHub

It’s only now that I’ve had time to take a look at this, and yes, there seems to be a problem in the MFE plugin when running behind a web proxy. Basically, the MFE web server is not available from the host. There are two ways to address this:

  1. We proxy the MFE web server with nginx, as you do with your custom plugin. In the general case, this means that a request follows this rather long path: Caddy (from the caddy container) :arrow_right: Nginx :arrow_right: Caddy (from the MFE container).
  2. When RUN_CADDY=false we expose the MFE service on the host (on port 8002). In such a case the user needs to manually configure the nginx/apache proxy to point to localhost:8002.

I’m not sure what’s the best approach here, but this use case needs to be addressed. Any opinion @developers @experts?

EDIT: I created an issue to keep track of this bug The MFE apps are unavailable when Tutor runs behind a web proxy (`RUN_CADDY=false`) · Issue #6 · overhangio/tutor-mfe · GitHub

Imho approach #1 (proxy MFE with nginx) is the simplest solution, also consistent with all the other modules. From your side, it would be the addition of a simple patch to the MFE project.

For people who run tutor behind a web proxy, it would also mean no need for changing their configuration, only run tutor local quickstart again.

As for the documentation, it should be corrected, but it would be nice I think to have a better section on how to run behind a web proxy with some basic configuration examples (the configs for nginx and apache that have been eliminated from the env), as it’s not everydays work to configure a web server as a proxy.

I think that I agree with you that proxying through nginx is the best solution. Who wants to open a pull request?

As for documenting proxy configuration: it’s kind of hard to end up with something that is accurate for all Web servers and ssl/tls configurations. Some of the apps that I recently installed (such as discourse) don’t provide much more information either.

If you are willing to write such a tutorial I’ll be happy to either include it or link to it from the docs.

I’m sorry for the comment… indeed people tried to help; the problem was a bit buried deep inside the initial topic, the reason I started a new topic. Again my apologies :blush:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.