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

[Support]: x-ingress-path works on first page but subsequent url history pushes are wrong #4526

Closed
drewp opened this issue Nov 27, 2022 · 3 comments · Fixed by #11677
Closed

Comments

@drewp
Copy link

drewp commented Nov 27, 2022

Describe the problem you are having

https://bigasterisk.com/frigate/ works (for my user) because I have pomerium set "x-ingress-path: /frigate" on all requests. I also have to strip /frigate, so your server receives request paths like /assets/index.26543.js (if I don't do this, requesting /frigate/assets/index.js returns some html page).

The working home page I see contains <script>window.baseUrl="/frigate/";</script>.

Now when I click on Birdseye, the url goes to https://bigasterisk.com/birdseye which is wrong. That should be /frigate/birdseye.

Version

dev branch from a few mins ago

Frigate config file

My k8s/pomerium ingress config:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: frigate
  annotations:
    cert-manager.io/issuer: letsencrypt-prod
    ingress.pomerium.io/allow_public_unauthenticated_access: "false"
    ingress.pomerium.io/pass_identity_headers: "true"
    ingress.pomerium.io/preserve_host_header: "true"
    ingress.pomerium.io/allow_websockets: "true"
    ingress.pomerium.io/policy: ...
    ingress.pomerium.io/prefix_rewrite: "/"
    ingress.pomerium.io/set_request_headers: |
      x-ingress-path: /frigate
spec:
  ingressClassName: pomerium
  rules:
    - host: "bigasterisk.com"
      http:
        paths:
          - pathType: Prefix
            path: /frigate/
            backend: { service: { name: frigate, port: { number: 80 } } }

----
Partial frigate config:

    mqtt:
      host: mosquitto-ext.default.svc.cluster.local
      port: 1883
      topic_prefix: frigate
      client_id: frigate
      stats_interval: 60

    detectors:
      cpu1:
        type: cpu
    logger:
      default: debug
      logs:
        peewee: warning
        peewee_migrate: warning

    cameras: ...

Relevant log output

Selected chrome inspector network urls that are fetched (note double-slash on the last one):

https://bigasterisk.com/frigate/
https://bigasterisk.com/frigate/assets/index.269d582e.js
https://bigasterisk.com/frigate/api/config
https://bigasterisk.com/frigate//api/garage_hall/latest.jpg?h=216

FFprobe output from your camera

n/a

Frigate stats

No response

Operating system

Debian

Install method

Docker CLI

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

various

Any other information that may be helpful

No response

@blakeblackshear
Copy link
Owner

Can you confirm that this works properly in 0.11?

@drewp
Copy link
Author

drewp commented Nov 27, 2022

In "docker.io/blakeblackshear/frigate:0.11.0" it is broken the same way.

@widewing
Copy link

widewing commented Feb 15, 2024

I'm having the same issue in latest version (0.13.1), similar setup. I can navigate to most of the pages by using the menu, but the URL is showing without a sub path, so when refreshing the page it will broken

sorenisanerd added a commit to sorenisanerd/frigate that referenced this issue Jun 1, 2024
When serving Frigate at a subpath, the paths that show in the URL bar
and that wind up in your browser history are anchored at the web root.
I.e. you go to `https://example.com/frigate/`, it changes to
`https://example.com/`, and clicking around works as expected, but the
`frigate/` prefix is gone.

It's confusing if you don't know that the URL's are entirely virtual.
Also, your browser history is useless, since the URL's point to e.g.
`https://example.com/#kitchen`, but visiting that URL will not hit
`/frigate/` at all.

Most of the work is already done. Nginx injects javascript to set
`window.baseURL` based on the X-Ingress-Path header. This change passes
that to BrowserRouter, so that it'll be part of the URL's it shows.

Fixes blakeblackshear#4526
NickM-27 pushed a commit that referenced this issue Jun 1, 2024
When serving Frigate at a subpath, the paths that show in the URL bar
and that wind up in your browser history are anchored at the web root.
I.e. you go to `https://example.com/frigate/`, it changes to
`https://example.com/`, and clicking around works as expected, but the
`frigate/` prefix is gone.

It's confusing if you don't know that the URL's are entirely virtual.
Also, your browser history is useless, since the URL's point to e.g.
`https://example.com/#kitchen`, but visiting that URL will not hit
`/frigate/` at all.

Most of the work is already done. Nginx injects javascript to set
`window.baseURL` based on the X-Ingress-Path header. This change passes
that to BrowserRouter, so that it'll be part of the URL's it shows.

Fixes #4526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants