'localhost', does not match expected hostname with basic Caddy reverse proxy

I've managed to get Jira up on my server now, it's a vanilla installation straight from the install docs running on port 8990 and connected to a postgres db on localhost.

My reverse proxy is Caddy, it simply redirects http://jira.mydomain to http://localhost:8990 (no SSL, that looks like a nightmare to set up, one of the reasons I use Caddy is the automated SSL - but I won't bother with that right now).

I first got the baseurl error which I fixed. Now I'm getting this other error which seems like its trying to use localhost for every reletive address.

The dashboard shows the `UrlHostnameMismatchException` but I've tried to set the hostname URL via server.xml:

<Engine name="Catalina" defaultHost="jira.mydomain">
    <Host name="jira.mydomain" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">

Restarted and still the same error. How on earth do I fix this? Do I have to modify the Caddy config to do something or change the Jira config?

I'd rather not install another proxy just for Atlassian apps, Caddy does a great job for my existing services and the painless HTTPS support is great.

1 answer

1 accepted

This widget could not be displayed.

I figured it out straight after, but maybe this will be useful. If you're a Caddy reverse-proxy user and you stumbled upon this, I hope it helps!

The solution is to add a `proxyName` and `proxyPort` attribute to the `<Connector>` object:

<Connector port="8990"
    maxThreads="150"
    minSpareThreads="25"
    connectionTimeout="20000"

    proxyName="jira.mydomain"
    proxyPort="80"

Annoyingly, this information was buried in Apache specific documentation whereas it's software-agnostic when it comes to reverse proxy applications.

I'm now going to try HTTPS with Caddy's auto-installed certs and update this response...

SSL with Caddy's auto-install was simpler than I thought!

Just add the `scheme` field alongside `proxyName`, set `proxyPort` to 443 and modify your Caddyfile to use https.

    ...
    proxyName="jira.mydomain"
    proxyPort="433"
scheme="https"

You might also want to add:

secure="true"

Oh yeah I forgot to mention, I was looking for documentation on that attribute but couldn't find any. What does it actually mean?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

229 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you