FLM / symfony-webpack-react

Boilerplate project based on Symfony Standard, with Webpack and React added.
24 stars 8 forks source link

Hi I'm getting a issue #2

Closed hounded closed 8 years ago

hounded commented 8 years ago

Warning: [react-router] Location "/sym-react/web/app_dev.php/" did not match any routes

ghost commented 8 years ago

I think the router expects the route to be www.your-domain.xx/app_dev.php in development mode.

Try changing the 'app_dev.php' string in https://github.com/FLM/symfony-webpack-react/blob/42734690eb2217a4e6bb800fa329fbb09ea1c36c/app/Resources/js/router/myHistory.js

hounded commented 8 years ago
action @ 12:06:51.969 @@router/LOCATION_CHANGE 
 prev state Object { routing={...}}
index.js? (line 164)
 action Object { type="@@router/LOCATION_CHANGE",  payload={...}}
index.js? (line 168)
 next state Object { routing={...}}
index.js? (line 176)
index.js? (line 152)
Warning: [react-router] Location "/sym-react/web/app_dev.php/" did not match any routes

console.error(message);

my console log above

I have tried many variation of the following

const basePath = (__GLOBALS__.dev ? 'http://localhost/sym-react/web/app_dev.php' : '');
const basePath = (__GLOBALS__.dev ? 'http://127.0.0.1/sym-react/web/app_dev.php' : '');
const basePath = (__GLOBALS__.dev ? 'localhost/sym-react/web/app_dev.php' : '');
etc etc

my server

<VirtualHost *:80>
    ServerName sym-react
    ServerAlias sym-react

    DocumentRoot "c:/wamp/www/sym-react/"
    <Directory c:/wamp/www/sym-react>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    # optionally disable the RewriteEngine for the asset directories
    # which will allow apache to simply reply with a 404 when files are
    # not found instead of passing the request into the full symfony stack
    <Directory /var/www/forms/web/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </Directory>
    ErrorLog "C:\wamp\bin\apache\apache2.4.9\logs\project_error.log"
    CustomLog "C:\wamp\bin\apache\apache2.4.9\logs\project_access.log" combined

</VirtualHost>
hounded commented 8 years ago

hold up const basePath = (GLOBALS.dev ? '/sym-react/web/app_dev.php' : '');

worked,

thank you very much for your time !!

JialuZhang commented 3 years ago

@hounded

In your configuration,

    <Directory /var/www/forms/web/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </Directory>

the line "RewriteEngine Off“ is a silent misconfiguration. This means adding it to your system will not change any system behavior. "RewriteEngine Off" is introduced by Apache to explicitly disable all "RewriteRule" and "RewriteCond". That is to say, if you include multiple "RewriteRule" and "RewriteCond" parameters in your configuration, then instead of commenting them all, you can explicitly set “RewriteEngine Off” to disable all "RewriteRule". More importantly, the default value of “RewriteEngine" is already an "off", so adding “RewriteEngine off" is quite unnecessary and it may cause confusion to users. Since herein there is no "RewriteRule" in this directory, deleting “RewriteEngine Off” would be ideal. Related Apache source code snippet:

run_rewritemap_programs(server_rec *s , apr_pool_t *p){
if (conf->state == ENGINE_DISABLED) { // usage of "RewriteEngine"
  return APR_SUCCESS; // early return
rewritemap_program(...); // usage of "RewriteRule" 
}