-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to setup ingress to serve static content on kubernetes? #323
Comments
The Ingress Controller is not designed to serve static content. If you'd like to serve static content, consider having a separate Service for it. See #257 (comment) |
I know that this is an old issue, but for some cases the answer on "How to setup ingress to serve static content on kubernetes?" may be just setting add-base-url: "true" and rewrite-target: / annotations, e.g.
Hope this helps someone. |
it works fine indeed, but be careful with rewrites :) |
It
Hi @demidovsky, apiVersion: extensions/v1beta1 |
I have the same problem |
I have solved the issue by setting the base URL for all the static content to eg: /app/style.js from style.js and then it worked fine for me. |
Be advised that the You can see this because pretty much all nginxinc/kubernetes-ingress annotations are prefixed by |
How to setup ingress to serve static content at my app? The following annotation does not work. Since the Nginx ingress runs on a separate deployment with app pod, it seems like it cloud not access static content in app pod.
@pleshakov
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.org/client-max-body-size: "2m"
nginx.org/server-snippets: |
location ~ ^/(assets)/{
root /var/www/test/public;
gzip_static on;
expires max;
add_header Cache-Control public;
}
The text was updated successfully, but these errors were encountered: