wurmlab / sequenceserver

Intuitive graphical web interface for running BLAST bioinformatics tool (i.e. have your own custom NCBI BLAST site!)
https://sequenceserver.com
GNU Affero General Public License v3.0
271 stars 113 forks source link

Remove hard coded paths in views. #125

Closed jvhaarst closed 10 years ago

jvhaarst commented 10 years ago

I have just been bitten by the fact that sequenceserver encodes the URLs for the css and js directories with hard paths. Somehow this messed up the proxying by Apache, after I made the paths relative (and thus removing most of the templating), it now works. The resulting head looks like this:

<head>
  <title>SequenceServer: Custom BLAST Server</title>
  <meta name="author" content="Anurag Priyam" />
  <meta name="author" content="Ben J. Woodcroft" />
  <meta name="author" content="Yannick Wurm" />
  <meta name="author" content="Cedric Wurm" />
  <meta name="description" content="Custom BLAST server provided by SequenceServer (http://www.sequenceserver.com)"/>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
  <script type="text/javascript" src="js/store.min.js"></script>
  <script type="text/javascript" src="js/jquery.js"></script>
  <script type="text/javascript" src="js/jquery-ui.js"></script>
  <script type="text/javascript" src="js/jquery.enablePlaceholder.min.js"></script>
  <script type="text/javascript" src="js/jquery.activity.js"></script>
  <script type="text/javascript" src="js/jquery-scrollspy.js"></script>
  <script type="text/javascript" src="js/bootstrap.transition.js"></script>
  <script type="text/javascript" src="js/bootstrap.dropdown.js"></script>
  <script type="text/javascript" src="js/bootstrap.modal.js"></script>
  <script type="text/javascript" src="js/sequenceserver.js"></script>
  <script type="text/javascript" src="js/sequenceserver.blast.js"></script>

  <link rel="stylesheet" media="screen" type="text/css" href="css/bootstrap.min.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="css/bootstrap.dropdown.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="css/bootstrap.modal.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="css/bootstrap.icons.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="css/custom.css" />
</head>

Is there a reason why you do not make the URLs to the css and js directories relative links ?

yeban commented 10 years ago

URL for assets aren't exactly hardcoded. They are generated by a helper method - uri - as you would have noticed.

For relative urls to work in a sub-uri deployment, it is essential that the uri ends in a trailing slash. That is, antgenomes.org/blast/ will work, but for antgenomes.org/blast browser will try to load assets from the base uri antgenomes.org/. To work around that you would either rewrite urls (mod_rewrite) or make assets available on the base url. Using the uri helper felt like the simplest solution back then.

This is what I did for reverse proxy setup on http://antgenomes.org/blast - https://github.com/yeban/sequenceserver/commit/aa0d1ab98f62cb51f2ca8c431b4695b3919280ed

I think I will change to relative URLs now. Thanks for bringing this up!

jvhaarst commented 10 years ago

That's great !

yeban commented 10 years ago

via e924f47d1879f7a3e9086d32a5f1d36ca014266d.

A release could take some time though.