I think I just found the problem. In  upload/index.php the first line after <?php isheader('Location: http://'.$_SERVER.'/osticket/upload/scp');die();//SYNOLOGY-REDIRECTIt's obviously been added by Synology (but not that obvious to me since I've been looking at the file for a better part of 2 hours). I first tried just taking out the /scp but that didn't work, so I just commented the line out and it seems to work the way it used to.  Of course, this may cause a domino effect somewhere else.  I don't know if this will help with the URL changing to IP problem the original poster has, but worth trying.  I wonder if Synology's changing from Apache to nginx server that I've been reading (but not really understanding yet) has anything to do with this line being added? Maybe somebody can enlighten me.EDIT: Yup, that line was not in the index.php before I upgraded to 1.10 a couple of weeks ago.  I found it on my backup.  Makes you wonder what other edits there are.

@[deleted] Thank you for sharing your findings and workaround! I'm checking with Synology support to see if anyone knows why that line was added.

According to Matt at Synology Support (Ticket: #1107806), I must have modified the upload/index.php file and caused the problem myself. Here is the response I received:We do not have any information on why that was added, but as there have been no other reported cases or known issues, nor are there any updates that would modify user files we do not believe this could have been caused by an update published by us. The only way that file could have been modified is by user intervention.

Say what!? So the line just appeared magically? With the 'SYNOLOGY-REDIRECT' comment? I don't know enough about PHP to add that line myself let alone doing it in the last few weeks when I upgraded. I downloaded the 1.10 upgrade from Synology's Package Center.  Someone is not owning up to this.  But at least my osTicket installation is working again, so far, and it's not a mission-critical app when (I mean if) it breaks again.Thanks for the update.  Hope your osTicket starts working again.

I found this line in the upload/include/upgrader/done.inc.php file:exec("/bin/sed -i \"/SYNOLOGY-REDIRECT/d\" /var/services/web/osticket/upload/index.php", $execOutput, $execStatus);I don't know what this does nor do I have time right now to research it, but it's pointing to the index.php file previously in question. There is also a directory called 'synology_added' under the volume1/@appstore/osTicket directory that is dated in May of this year.  I don't know why I think this, but I assume Synology may have added it. It has a few files in it, but I don't know what they do either.  I also assume they are installation files.

Well, I couldn't leave it alone, but the command (edited for brevity):/bin/sed -i "/SYNOLOGY-REDIRECT/d" index.phpdeletes a line with "SYNOLOGY-REDIRECT" in index.php and writes the file back to itself.  I guess this didn't work with my installation, but obviously somebody somewhere (Synology) is modifying files.  Therefore the statement from Matt at Synology: "...nor are there any updates that would modify user files..." is incorrect.  I don't know why they, or anybody, can't just say: "We did that, it didn't work, now let's try to get it fixed."

@[deleted] Thanks a ton for tracking this down and posting your findings. I'd be lost (and my osTicket would still be broken) without your assistance. I'll share the info about the upload/include/upgrader/done.inc.php file and perhaps finally convince Synology that THEIR code contributed to the problem so that they can address the bug.

So I guess this fixed your URL rewrite to IP problem you were originally having?  Glad I could help.  I'm truly a noob at this linux stuff. I learn just enough to fix my current problem, then immediately forget it!  That's why I've been using osTicket to catalog a lot of my IT solutions because I can't remember things like I did in my 30's.  I've written some PHP but am by no means an expert as per my previous posts. We got two birds since I was trying to fix a different problem than yours.  My search just led me to this discussion thread and the one poster who had the exact same problem I was having.  I'm not using a URL but I guess the "Redirection" phrase in the title caught my attention.Thanks for following up with Synology.  Hopefully they will get it straight.PS. How do you tag a person in these discussions like you did me (@dmitchell) in your reply?

@[deleted] works, just type the @ symbol followed by the username.

I'm just checking back in on this thread and noticed what may be the source cause of the problem and the solution. Thanks to everyone who worked on this. I will give the fix a test drive and see if that fixes it for me. 

6 years later

fzs122
Check the Apache configuration on your Synology Diskstation. Look for any specific rules or directives related to URL rewriting. Verify that the configuration allows for the desired URL structure and doesn't interfere with the osTicket system's handling of URLs.

Write a Reply...