Skip to content

Adding subfolder support - #186

Merged
gmetais merged 6 commits into
YellowLabTools:masterfrom
JulienRamel:master
Aug 18, 2016
Merged

Adding subfolder support#186
gmetais merged 6 commits into
YellowLabTools:masterfrom
JulienRamel:master

Conversation

@JulienRamel

Copy link
Copy Markdown
Contributor

Hi @gmetais,

I did some changes to the application to add a support of subfolder use, for example behind a reverse proxy. The application was not usable in /subfolder because of the absolute paths used for assets and by AngularJS for views.

I added a "baseUrl" parameter in the settings file, by default set to "/". This parameter is injected in the tag in the main HTML document. To be able to inject a parameter in the HTML, I added a HTML template engine named EJS. The static method from Express is still used for assets. Then I changed all the absolute paths for relative ones (assets, API, results, etc).

The scenario is to let "/" for a use on a domain without subfolder, and to configure the full URL for a subfolder (with a trailing slash). Example : "https://domain.com/yellowlabtools".

It's my first time working on NodeJS, Express, EJS and AngularJS, so feel free to let me comments about the development :-)

I've tested on a reverse proxy on nginx and Apache.

Comment thread front/src/main.html Outdated
<div class="github"><iframe id="ghbtn" frameborder="0" scrolling="0" width="145px" height="30px"></iframe></div>
</div>

<!-- build:js /js/all.js -->

@gmetais gmetais Aug 17, 2016

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove the slash on /js/all.js as well. In case someone runs the optimized version of the server, this is the path of the compiled JS file.

@gmetais

gmetais commented Aug 17, 2016

Copy link
Copy Markdown
Collaborator

Thanks a lot for this cool work!

I marked a few details, please tell me if its unclear.

Until now I was using grunt-replace to insert variables into the templates (for 2 variables: googleAnalyticsId and version). EJS looks very simple and I'll replace grunt-replace :)

@JulienRamel

Copy link
Copy Markdown
Contributor Author

Hi,
I commited some fixes. Let me know :)
Julien

Comment thread front/src/main.html Outdated
<meta property="og:image" content="img/logo-large.png" />
<meta name="description" content="Free online web performance tool. Audit your webpage for performance and front-end quality issues. And it's open-source!" />

<!-- build:css /css/styles.css-->

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with <!-- build:css /css/styles.css-->, sorry I didn't catch it the first time :/

@gmetais

gmetais commented Aug 18, 2016

Copy link
Copy Markdown
Collaborator

Thanks, just one little more change and we're good to go!

@JulienRamel

Copy link
Copy Markdown
Contributor Author

👍

@gmetais

gmetais commented Aug 18, 2016

Copy link
Copy Markdown
Collaborator

Great job!

@gmetais
gmetais merged commit cee48c1 into YellowLabTools:master Aug 18, 2016
@y0hnn

y0hnn commented Sep 16, 2016

Copy link
Copy Markdown

Hi,
I still have some issues on my side :

  • Links for the detailed items are using an absolute path. For example /result/eihop0w1bt/rule/hiddenImages.
  • In the Console, I see a 404 for the screenshot image. This is an absolute path too : /api/results/eihop0w1bt/screenshot.jpg

@gmetais

gmetais commented Sep 17, 2016

Copy link
Copy Markdown
Collaborator

Thank you for reporting this.

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

Successfully merging this pull request may close these issues.

3 participants