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

Router config of static files directory does not work properly #141

Closed
pavsyk opened this issue Jan 6, 2018 · 4 comments
Closed

Router config of static files directory does not work properly #141

pavsyk opened this issue Jan 6, 2018 · 4 comments
Assignees
Labels
Projects

Comments

@pavsyk
Copy link

pavsyk commented Jan 6, 2018

If you want to place static files into other directory then "static" (see the excerpt from the routes.conf):

      public_assets {
        path = "/assets"
        dir = "assets"
      }
      favicon {
        path = "/favicon.png"
        file = "img/favicon.png"
      }

Then the URL http://localhost:8080/favicon.png returns 404, because the framework is still trying to deliver the static/img/favicon.png file instead of assets/img/favicon.png. It seems that the "static" prefix is hardcoded here, but it should take the static/public_assets/dir config value instead.

@jeevatkm
Copy link
Member

jeevatkm commented Jan 6, 2018

@pavsyk Thanks for reporting an issue. I will have a analyze and get back to you.

@jeevatkm jeevatkm self-assigned this Jan 6, 2018
@jeevatkm
Copy link
Member

jeevatkm commented Jan 9, 2018

@pavsyk Thanks, I have analyzed it. Sorry for late response, caught up with some work.

Yes, you're right. Can you use default directory named static and map path to /assets?

By design router and static file delivery supports many directories and files from relative to absolute paths. I need to think about flexible configuration for your described scenario.

For e.g.: One of my thought

public_assets {
  path = "/assets"
  dir = "assets"
}

public_downloads {
  path = "/file/downloads"
  dir = "/home/aah/downloads"
  list = true
}

favicon {
  path = "/favicon.png"
  file = "img/favicon.png"

  # by using references if multiple directories defined 
  # otherwise use the one defined automatically.
  base_dir = public_assets.dir   OR    base_dir = "assets"
}

@jeevatkm jeevatkm added this to the v0.10 Milestone milestone Jan 9, 2018
@pavsyk
Copy link
Author

pavsyk commented Jan 9, 2018

@jeevatkm Thanks. Yes, it is what I did (i.e. mapped the static dir to /assets path) as a workaround.

@jeevatkm jeevatkm added this to v0.10 - Iteration in aah Roadmap Feb 25, 2018
@jeevatkm jeevatkm moved this from v0.10 - Iteration to v0.10 - In Progress in aah Roadmap Mar 4, 2018
jeevatkm added a commit to go-aah/router that referenced this issue Mar 5, 2018
jeevatkm added a commit that referenced this issue Mar 5, 2018
…om routes.conf

- added "base_dir" attribute support for static file mapping and fallback to "public_assets.dir"
jeevatkm added a commit that referenced this issue Mar 5, 2018
…routes.conf (#147)

- added "base_dir" attribute support for static file mapping and fallback to "public_assets.dir"
@jeevatkm
Copy link
Member

jeevatkm commented Mar 5, 2018

@pavsyk Thank you for your patience. I have implemented this enhancement, currently available on edge version. You can give it try.

To be released as part v0.10 😄

PS: BTW aah docker images are available https://hub.docker.com/r/aahframework/aah

@jeevatkm jeevatkm closed this as completed Mar 5, 2018
@jeevatkm jeevatkm moved this from v0.10 - In Progress to v0.10 - Completed in aah Roadmap Mar 5, 2018
@jeevatkm jeevatkm added the lib-router Request Routing label Mar 10, 2018
@jeevatkm jeevatkm moved this from v0.10 - Completed to Released to Audience in aah Roadmap Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
aah Roadmap
  
Released to Audience
Development

No branches or pull requests

2 participants