Skip to content
This repository was 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

@djnicholson

Description

@djnicholson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions