Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

App only works when hosted within the root directory of a domain #27

Open
djnicholson opened this issue Dec 14, 2018 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@djnicholson
Copy link

My clone of animal-kingdom only works if accessed through a URL like: https://mydomain.test/index.html it does not work if accessed through a URL like https://mydomain.test/some/other/path/index.html

There are two classes of reason why:

  1. The Blockstack redirectToSignIn API is called with no parameters, meaning it uses the default manifest location (so manifest.json is expected to be at the root of the current domain). Note: I tried fixing this by changing line 15 of Landing.js from:
    this.userSession.redirectToSignIn()
    to:
    this.userSession.redirectToSignIn(window.location.href, window.location.href.replace(//[^\/]*$/, '/manifest.json'))
    but it did not work, maybe the manifestURI parameter documented at https://blockstack.github.io/blockstack.js/#redirecttosignin is being ignored?

  2. Throughout the application code, hrefs are created with a beginning slash, e.g.:
    App.js - window.location = /kingdom/${userData.username}
    EditMe.js -
    Kingdom.js - style={{backgroundImage: url('${app}/territories/${rulerTerritory.id}.jpg')}}
    NavBar.js - Animals
    ...
    Ideally these hrefs would be constructed relative to the initial URL used to render the app.

It will be much easier for people to fork and modify the app if it can be rendered from within sub-folders. For example, I wanted to commit my build folder to Git so I could just easily host my builds through GitHub pages, but I had to give up on that approach.

@moxiegirl moxiegirl added enhancement New feature or request good first issue Good for newcomers labels Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants