• Status Unconfirmed
  • Percent Complete
  • Task Type Information
  • Category Backend/Core
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 1.0 devel (github master)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Flyspray
Opened by aducom - 03.06.2018

FS#2466 - How to run under https

I have changed the htaccess.dist into .htaccess and modified to force https.
However, despite having https activated on my site I cannot get Flyspray running, it’s waiting forever.When I abort I get a page without makeup. I have all other applications like cms and wiki running under https, so it is something I have not done in the flyspray configs obviously (as this site is running https too). But could you give me a hint?

I installed flyspray in a subdirectory, if that is something to know about...

regards, Albert

In addition, I have set the subdir but I think the issue is in the html header:

  <script type="text/javascript" src=""></script>
  <script type="text/javascript" src=""></script>

I can't tell, but if I use the url without the :80 I am able to access the files. How can I prevent the :80 here?

Project Manager

Mmh, all generated links are Which should be

Most link generation use the $baseurl , which is set early in includes/ at between line 14-32.

Maybe a redirect loop?
Maybe Flyspray::absoluteURI() function produces that unwanted result?

What shows a simple wrap around

$baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/' ;

in includes/ (around line 31 in that file current 1.0-rc7 dev)

echo '<pre>';
echo '$webdir is '.$webdir."\n";
    $baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/' ;
echo '$baseurl is '. $baseurl."\n";
echo '$_SERVER ';
Project Manager

It seems you can also set
force_baseurl in your flyspray.conf.php

which is then used for overrule the automated stuff.

But better find the real reason.

I have created a ticket at my webhoster. If I find the reason (and solution) I will post it here. Otherwise I will try your work-arounds. Tnx for your response.

It is still under investigation, but the first reaction of the hoster was that the website (under e107) and wiki (mediawiki) where running well under https (they do) so that the issue should be found within the flyspray environment. That reaction was to be expected. I'll try your options.

Project Manager

I think the error or misconfiguration is easy to locate by following

and showing the output of that code example change there.

Which version of Flyspray do you installed?

I'm using the current stable. I'm running it on another site on https without problems. So it must be something of the hoster config. However they advised me to set some rewrites that are already there in the .htaccess. I'll try your option.

You're right, baseurl is not giving the expected result:

$webdir is /flyspray
$baseurl is $_SERVER Array

  [ONECOM_DOMAIN_ROOT] => /customers/3/0/6/
  [ONECOM_MEMORYLIMIT] => 1073741824
  [ONECOM_EXEC] => php7.0
  [HTTP_CONNECTION] => close
  [SCRIPT_NAME] => /flyspray/index.php
  [REQUEST_URI] => /flyspray/
  [REMOTE_PORT] => 44942
  [SCRIPT_FILENAME] => /customers/3/0/6/
  [SERVER_PORT] => 80
  [PATH] => /usr/local/bin:/usr/bin:/bin
  [HTTP_X_VARNISH] => 476976043
  [HTTP_CACHE_CONTROL] => max-age=0
  [HTTP_COOKIE] => flyspray=c9d1sleeebrho9300fkpmtn9i3tenp0i; cookieconsent_dismissed=yes; PHsP_cookieSID=63g54dts8soodspjk024incqhnn80423hgae9jp9r6ovf2ejgrk4idk56o31u5q3nabjd69cdkfrs716kl09ipn9i1gfbvdfjhp2v43
  [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
  [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
  [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
  [HTTP_SCHEME] => https
  [HTTP_HOST] =>
  [HTTPS] => on
  [ONECOM_TMPDIR] => /customers/3/0/6/
  [ONECOM_DOCUMENT_ROOT] => /customers/3/0/6/
  [DOCUMENT_ROOT] => /customers/3/0/6/
  [PHP_SELF] => /flyspray/index.php
  [REQUEST_TIME_FLOAT] => 1529086060.3722
  [REQUEST_TIME] => 1529086060


A quick (and very dirty solution for now)

  $baseurl = str_replace(':80','', rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/' );

This solution was not sufficient, also assigning $baseurl directly with the correct url doesn't work fully. Once you logon you still get the :80 error. It is caused in the authenticate.php where Flyspray::Redirect(Req::val('return_to')); does not contain the correct value. Once I changed it to $baseurl it was working well (so far).

Project Manager

Maybe this is related to FS#2142

Your $_SERVER vars like [HTTP_X_VARNISH] ⇒ 476976043


indicates your hosting is using a proxy ? (I'm not familiar with 'reverse proxy', so if I' wrong correct me.)

Yeah, that does look like there's an http reverse proxy (aka gateway). The port the headers are listing for the incoming connection being on is port 80, which is the http port and not the https one. It looks like the proxying is done over https nonetheless - perhaps worth asking the provider why [SERVER_PORT] is 80 for an https connection :)

The section of the flyspray code which decides whether or not to include the port number for an https protocol connection for the post-authentication url generation is in includes/class.flyspray.php and is this:

        if ($protocol == 'https' && $port == 443) {

I'm guessing in this flyspray instance setup it is seeing a $port of 80 so it's not unsetting it from inclusion in the url.

aducom - in my reverse proxy setup I edited that section to unset $port conditionally - if you know that you'll never access your flyspray instance via urls which include a port number you could just change it to always do unset($port). Of course you'll need to remember to reapply the same fix if you ever update (unless/until FS#2142 is sorted).

I don't know actually as I'm on a hosting package. I managed to get the latest version running with some tweaks:

in class.flyspray.php I had to change around line 717

$url = Flyspray::absoluteURI($url);

$url = str_replace(':80','', rtrim(Flyspray::absoluteURI($url),'/\\') . '/' );

Which is the same tweak as described above. Without this tweak you get an error message after log on.


Available keyboard shortcuts


Task Details

Task Editing