the Polymer Starter Kit (PSK) contains instructions on using Pretty URLs when hosting on Firebase HERE
I am attempting to do similar using Nginx Server, but cannot figure out the Location Block for page reloads. Using the sample data that comes with PSK, how would you configure "/users/sam", for example.
nginx config
server {
listen 80;
server_name example.com;
root /home/myuser/psk/dist;
index index.html;
location /
{
try_files $uri /index.html;
}
}
Make sure to add a base url to your index.html. In case of Polymer starter kit & nginx the base element will help direct access to URLs with query parameters such as : http://example.com/users/Chuck that you can find under "Users" in PSK 1.2.x
<html>
<head>
<base href="/">
...
Otherwise nginx will go into a loop without a base URL.
nginx error.log
rewrite or internal redirection cycle while internally redirecting to "/index.html"
Browser goes into an infinite cycle loading the index page instead of static files.
Uncaught SyntaxError: Unexpected token <
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With