Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute links for CSS and Java #132

Open
hymie0 opened this issue Sep 9, 2019 · 5 comments
Open

Absolute links for CSS and Java #132

hymie0 opened this issue Sep 9, 2019 · 5 comments

Comments

@hymie0
Copy link

hymie0 commented Sep 9, 2019

Greetings. It doesn't look like any work is happening here anymore, but I thought I would ask anyway.

Most of the links generated by taskwarrior-web are relative links... but some of them -specifically, the CSS and the JavaScript links -- are absolute.

This creates a problem for me. I have an oddball setup, where I have an SSL frontend on my firewall/bastion host, but the internal servers are all running HTTP.

So what this means is that, when I take my browser to https://host.domain.name:5678/ , my firewall goes internally to my http site, and all of the CSS and JS links are returned to my browser as http://host.domain.name:5678/css/ ... and those don't work.

All of the other links are (or, at least, appear to be) relative links, and my browser interprets them correctly.

I tried to find where this was happening, but I don't speak Ruby and I couldn't find it.

Anyway, I'd really like these CSS and JS links to be relative instead of absolute.

@cilynx
Copy link
Collaborator

cilynx commented Sep 9, 2019

As you say, this project isn't strongly maintained at this point. That said, I think this might be a quick fix. The CSS and JS asset links are defined here:

<link rel="stylesheet" href="<%= url("/css/#{file}.css") %>">
<% end %>
<!-- Scripts -->
<% %w(jquery.min bootstrap bootstrap-datepicker jquery.hotkeys jquery.dataTables.min tinycon.min application).each do |file| %>
<script text="text/javascript" src="<%= url("/js/#{file}.js") %>"></script>

I'm honestly not sure how the url() function is supposed to act as it's not what I've seen used in other projects. I've created a new branch where I replaced url() with url_for(). In my experience, url_for() has :only_path set to True by default, so it should return relative paths.

Give that branch a try and let us know how it goes.

@hymie0
Copy link
Author

hymie0 commented Sep 9, 2019

Thank you for the tip. I ended up with something simpler (I don't know if it will work properly for everybody, but it works for me). I took out the url() entirely and ended up with

<% %w(bootstrap.min datepicker styles).each do |file| %>
  <link rel="stylesheet" href="/css/<%=file%>.css">
<% end %>

(It's happening somewhere else too, but I can't figure out exactly where yet.)

@cilynx
Copy link
Collaborator

cilynx commented Sep 9, 2019

Check the commit I linked above -- the diff includes the other locations of the absolute url() function.

@hymie0
Copy link
Author

hymie0 commented Sep 9, 2019

Something in the 302 redirection is doing the same thing.

$ curl -i https://lactose.homelinux.net:5678/
HTTP/1.1 302 Found
Content-Type: text/html;charset=utf-8
Location: http://lactose.homelinux.net:5678/tasks/pending

I think I found the redirect calls in lib/taskwarrior-web/app.rb ... but I haven't traced it past there yet...

@cilynx
Copy link
Collaborator

cilynx commented Sep 9, 2019

Losing HTTPS on 302 with SSL proxies is a known issue that a few folks have gotten around. Check out: #20, #56, and this wiki page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants