craftcms / craftcms/cms

Run Craft behind a reverse proxy on subpath

Open
#9,909 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

When running craft behind a reverse proxy in this manner:

/ => frontend
/backend => Craft

Calls to index.php always resolve to the root of the domain and therefore fail. Is there a way to solve this problem. Without placing craft in that subdirectory. Background we run Craft and SSR Vue.js Docker Containers along. To avoid CORS Issues we would like to serve the Craft container from a subpath of the domain.

Additional info
  • Craft version: 3.7
  • PHP version: 7.4
  • Database driver & version: Mysql 5.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Craft 3.7 setup with PHP 7.4, Docker containers, and the reverse-proxy mapping of / to the frontend and /backend to Craft. Trace how requests to index.php resolve under that subpath; done when Craft can be served at /backend without being installed there and the frontend remains at /.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.