1

I have a Craft CMS blog site that is hosted on an apache web server. I would like to proxy that site to my Flask-based web app at http://example.com/blog/ where http://example.com is the main URL for the app. http://example.com/blog/ does not have any application routes so it is a safe URL to use.

Here is the relevant part of my NGINX config.

    location ^~ /blog/ {
        include proxy_params;
        proxy_pass http://cms.example.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
        auth_basic "Stealth Mode - Coming Soonish";
        auth_basic_user_file /etc/nginx/.htpasswd;

        include proxy_params;
        proxy_pass http://127.0.0.1:3000;
    }

My problem is that I get the following Template Not Found error.

    Template not found: blog

Any ideas how to fix this? The fact that I am getting a Craft error indicates to me that the issue is a craft config issue, but I am not ruling out some sort of nginx error config error.

3
  • Update. I have pretty much eliminated Nginx as the issue here since I was able to proxy a static site through. So I think I am looking at a Craftcms issue here. Jun 19 at 19:04
  • 1
    In your case, when you hit cms.example.com directly (outside of nginx) what happens? That's the blog "home page" more or less? Jun 19 at 19:07
  • When I hit cms.example.com directly the site renders properly but as cms.example.com and not cms.example.com/blog. The difference is that I am trying to reverse proxy it under example.com/blog Jun 20 at 1:29
1

I discovered the issue. The issue was a conflict in the craft. I had the wrong URL in Settings > Sites: [This site has its own base URL] should be clicked and the correct URL should be provided. When the site is live I will come back and post more information to demonstrate the result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.