Skip to content
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

Allow nginx-ingress redirect/rewrite to work with the API #99

Open
peasoupio opened this issue Jun 16, 2020 · 0 comments
Open

Allow nginx-ingress redirect/rewrite to work with the API #99

peasoupio opened this issue Jun 16, 2020 · 0 comments
Assignees
Labels
composer Related to Composer enhancement New feature or request

Comments

@peasoupio
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
When using nginx-ingress (with Kubernetes), static files are rewritten, but API calls use the "default" ("/") path instead of the new one.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: composer
spec:
  rules:
    - host: localhost
      http:
        paths:
        - backend:
            serviceName: composer
            servicePort: 5050
          path: /composer(/|$)(.*)

Describe the solution you'd like
In the previous examples, API (xhr calls) should use the "/composer" path instead of "/".

Describe alternatives you've considered
Axios has a baseURL configuration and since Composer is a SPA, something like this should work:

// Allow nginx redirection
window.axios.defaults.baseURL = window.location.href.substr(0, window.location.href.lastIndexOf("/")) + "/"
@peasoupio peasoupio added enhancement New feature or request composer Related to Composer labels Jun 16, 2020
@peasoupio peasoupio self-assigned this Jul 12, 2020
@peasoupio peasoupio removed their assignment Jul 22, 2020
@benjboyer benjboyer self-assigned this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
composer Related to Composer enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant