Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access monicahq un subpath via reverse proxy #7309

Open
3 tasks done
gardiol opened this issue May 31, 2024 · 2 comments
Open
3 tasks done

Unable to access monicahq un subpath via reverse proxy #7309

gardiol opened this issue May 31, 2024 · 2 comments
Labels

Comments

@gardiol
Copy link

gardiol commented May 31, 2024

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • I agree to follow Monica's Code of Conduct.

Bug description

Unable to access monicahq from reverse proxy on subpath (mydomain.com/monicahq)

Steps to reproduce

I have deployed mponicahq using docker compose, here is the compose file i am using:

version: "3.9"

services:
  app:
    image: monica:apache
    depends_on:
      - db
    ports:
      - 9980:80
    environment:
      - APP_ENV=local
      - APP_KEY=blahblahblah
      - APP_URL=https://mydomain.com/monicahq
      - APP_TRUSTED_PROXIES=*
      - DB_HOST=db
      - DB_DATABASE=monica
      - DB_USERNAME=monica
      - DB_PASSWORD=monica_secret
      - LOG_CHANNEL=stderr
      - CACHE_DRIVER=database
      - SESSION_DRIVER=database
      - QUEUE_DRIVER=sync
    volumes:
      - /monicahq/storage:/var/www/html/storage
    networks:
      - monicahq-net

  db:
    image: mariadb:latest
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_DATABASE=monica
      - MYSQL_USER=monica
      - MYSQL_PASSWORD=monica_secret
    volumes:
      - /monicahq/mysql:/var/lib/mysql
    networks:
      - monicahq-net

networks:
  monicahq-net: {}

It runs, and i can access the register page via http://127.0.0.1:9980

If i add on top of it my reverse proxy:

location /monicahq/ {
    proxy_pass         http://127.0.0.1:9980/;
    proxy_redirect     off;
    proxy_set_header   Host $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 $server_name;
}

(only relevant location section)

it doesnt work. Browser report a 302 redirect to http://mydomain.com/register insterad of the correct https://mydomain.com/monicahq/register that i am expecting.

Am i doing something wrong? According to the docs i could find, it should work.

Expected behavior

Monicahq accessible at https://mydomain.com/monicahq

Environment

Your own self-hosted instance (monica v4)

Version of Monica

No response

Installation method

Docker image

Web server

Apache

Database engine version

MariaDB

Additional info

No response

@gardiol gardiol added the bug label May 31, 2024
@Crikxi
Copy link

Crikxi commented Aug 25, 2024

I have the same issue on monica v5.0.0-beta.4 after changing my APP_URL from http URL to https URL.
Setting the environment variable APP_FORCE_URL=true seems to fix the issue.

@gardiol
Copy link
Author

gardiol commented Aug 26, 2024

thanks, good to know for future reference, but i gave up on this anyway, and it seems there is not much support going on anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants