Search

For a recent project, I implemented an NGINX proxy server to proxy requests from a Symphony installation on a subdomain (blog.foo.com) so that they appear to come from a subdirectory of the main domain (www.foo.com/blog).

This does work, however I still have to login to Symphony via blog.foo.com/symphony. Besides being cumbersome it brings with it the problem that no login cookie (I assume that's how it works) is created at www.foo.com.

So:

Is there a way to proxy the entire Symphony installation to www.foo.com/blog so that I can access Symphony via www.foo.com/blog/symphony?

I toyed a little with the .htaccess file already but to no avail.

Thanks for any pointers!

Take a look at your cookie domain after login, and you will see that Symphony sets a cookie for blog.foo.com. This is normal behaviour, because Apache is running on this subdomain, and the request (by nginx) is for this subdomain. I see no way to change this easily. You need to understand that Symphony does not "see where a request has been proxied from", and this wouldn't make much sense either.

You would have to hack Symphony, i.e the getDomain function in /symphony/lib/core/class.session.php to manipulate the way Symphony finds the cookie domain. But be warned, changing this can have severe effects, even on security.

Hi Michael, thanks for the info. You are of course completely right.

I ended up running the website on two domains, www.foo.com/blog and blog.foo.com. Whenever I want to log into Symphony and make changes to the website I use blog.foo.com. However, I try to keep this subdomain secret and my users will only see www.foo.com/blog.

Defining a $blog-url variable in Symphony has helped me a lot:

<xsl:variable name="blog-url">
    <xsl:choose>
        <xsl:when test="$http-host = 'localhost:8888'">http://localhost:8888</xsl:when>
        <xsl:otherwise>
            <xsl:choose>
                <xsl:when test="$is-logged-in">
                    <xsl:value-of select="'https://blog.foo.com'" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="'https://www.foo.com/blog'" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details