Issues accessing ember app via apache web server


#1

I am running an Ember app locally and am able to access it via Ember server on http://localhost:4200/myApp/

However I want this to be able to run via my Apache server. So have added the following entry in httpd.conf

Alias /myApp "C:/myApp/dist"
<Directory "C:/myApp/dist">
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /myApp/index.html#$1 [L]
</Directory> 

Now when I hit through my Apache web server http://localhost/myApp/

it seems to load the index.html page, but cannot access the API call http://localhost/api/myApi?Id=user1 It gets 404

The same is accesssible via Ember server http://localhost:4200/api/myApi?Id=user1

This returns a local json as from my server folder.

For the adapter, I have;

export default DS.RESTAdapter.extend({
  namespace: '/api'
});

And my environment.js looks like

var ENV = {
    modulePrefix: 'myApp',
    environment: environment,
    baseURL: '/myApp/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    },
     contentSecurityPolicy: {
      'default-src': "'none'",
      'script-src': "'self'",
      'font-src': "'self'",
      'connect-src': "'self'",
      'img-src': "'self'",
      'style-src': "'self'",
      'media-src': "'self'"
    }
  };

Please suggest.


#2

This works:

https://github.com/broerse/ember-cli-blog/blob/master/public/.htaccess

The environment.js:


#3

Thanks a lot…Let me just try… Hmm…So the issue seems to be because of the mod rewrite settings ?

also is the environment.js change also related to that ?


#4

I showed the environment so you can see locationType: 'auto', is good.

Working example on Apache: http://exmer.com/bloggrcouch/posts