Note that there are some explanatory texts on larger screens.

plurals
  1. POember.js application does not update hashtag part of URI with NGINX server
    primarykey
    data
    text
    <p>I have an ember.js application I developped on my local machine. I use a restify/node.js server to make it available locally.</p> <p>When I navigate in my application, the address bar changes like this:</p> <p><strong>Example 1</strong></p> <pre><code>1. http://dev.server:3000/application/index.html#about 2. http://dev.server:3000/application/index.html#/items 3. http://dev.server:3000/application/index.html#/items/1 4. http://dev.server:3000/application/index.html#/items/2 </code></pre> <p>I try now to deploy it on a remote test server which runs nginx.</p> <p>Although everything works well locally, I can navigate into my web application but the part of the URI that is after the hashtag is not updated.</p> <p>In any browser: <code>http://test.server/application/index.html</code> is always displayed in my address bar. For the same sequence of clicks as in <strong>Exemple 1</strong>, I always have:</p> <pre><code>1. http://web.redirection/application/index.html 2. http://web.redirection/application/index.html 3. http://web.redirection/application/index.html 4. http://web.redirection/application/index.html </code></pre> <p>Moreover, if I directly enter a complete URI <code>http://web.redirection/application/index.html#/items/1</code> the browser will only display the content that is at <code>http://test.server/application/index.html</code> (which is definitely not the expected behaviour).</p> <p>I suppose this come from my NGINX configuration since the application works perfectly on a local restify server.</p> <p>NGINX configuration for this server is:</p> <p>test.server.conf (which is symlinked into /etc/nginx/sites-enabled/test.server.conf)</p> <pre><code> server { server_name test.server web.redirection; root /usr/share/nginx/test; index index.html index.htm; location / { try_files $uri $uri/ /index.html; } location ~ \.csv$ { alias /usr/share/nginx/test/$uri; } } </code></pre> <p>nginx.conf</p> <pre><code>user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log debug; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } </code></pre> <p><strong>EDIT:</strong> Just to be sure that there were no missing files on my test server: I ran a restify/node server (like on my dev machine) and <em>everything works fine</em> when I connect to this server (!). Both nginx and restify servers points to the same files.</p> <p><strong>EDIT 2</strong></p> <p>I discovered that my problem happens when I use a web redirection. If I use an address like <code>http://test.server/application/index.html</code> everything works fine If I use <code>http://web.redirection/application/index.html</code> it does not work.</p> <p>So this is my nginx conf that is not correctly redirecting web.redirection URI to test.server or something like that.</p> <p>Does someone has an idea ? What do I miss ? What should I change to make this work ?</p> <p><strong>EDIT 3 and solution</strong></p> <p>The web redirection I used was an A type DNS record. This does not work. Using a CNAME type DNS record solves the issue. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload