Updating the Emberjs application on a route other than the index gives a 404 error

I have a small ember application using the starter kit provided by the Ember-App-Kit (EAK) . I downloaded the distribution kit after assembly for production into an AWS EC2 instance.

Questions I have encountered now:

  • When I click on the root URL, I see the index page, going to any other route from the links that are on the index page, it works fine and allows me to go to this page. The problem occurs when I try to click update on the page itself.

At first I thought this was due to a permission error, but only one html file and js and css are loading properly. Then the thought may be a htaccess problem, so I tried to insert it, but after it there will be no effects. The broken version of the application source code is in the Source Code

.htaccess file used for redirecting ::

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule ^(.*)$ /index.html [L]
+4
source share
3 answers

In fact, I could not figure out how to do this with the Apache server, so I installed nginx and it worked with the rewrite rule that I presented in the configuration file.

server {
        root /var/www/{Your App Directory Path Here};
        index index.html index.htm;
        server_name {Your website URL or IP address here};

        location / {
                try_files $uri $uri/ /index.html?/$request_uri;
        }
}

Other discussions can be found here: Ember-App-Kit Git Repo Issue 486

+1

, FallbackRessource - :

FallbackResource /index.html

.htaccess, .htaccess , httpd.conf .

+1

Source: https://habr.com/ru/post/1526723/


All Articles