App routing issues after deploying polymer starter-kit to a nginx subfolder

209 views Asked by At

I have some issues with the polymer app-routing after deploying the starter-kit to a nginx docker container.

First, the steps I have done to deploy the example:

  1. I created the starter-kit project with polymer init starter-kit.
  2. After that, I had to remove the first "/" from <link rel="import" href="/src/my-app.html"> (href in index.html).
  3. I built the test app and copy the unbundled version to the nginx docker container (folder /usr/share/nginx/test/unbundled)
  4. I configured the nginx server as follows (nginx.conf):

    events {}
    http {
        server {
            charset UTF-8;
            listen 80;
            server_name localhost;
            root /usr/share/nginx/test;
            index index.html;
    
            location /unbundled {
            root /usr/share/nginx/test;
            }
        }}
    
  5. After that I started the nginx server and opened the url http://localhost/unbundled

Now to my issue: After Step 5 I thought that I land on the view1-page. But 404 page appears.

After clicking on view1 the proper page was visible but then the url isn't correct anymore. Instead of getting http://localhost/unbundled/view1 the click on this link resolve the url http://localhost/view1. I understand why (a href points to /view), but I don't not know how I can solve this issue. I don't know if its a polymer app-routing or a nginx-configuration problem.

Could someone give me a hint here how I can deploy apps with app-routing into a subfolder and get the app-routing navigation done correctly?

Best Regards Alex

0

There are 0 answers