upptime icon indicating copy to clipboard operation
upptime copied to clipboard

Wrong apiBaseUrl logic.

Open GammaPi opened this issue 3 years ago • 5 comments

Describe the bug If I specify apiBaseUrl, I will not be able to fetch status.json.

The root cause is L14.

Github raw user content is used to fetch summary.json and generated latency graphs. While github api is used to fetch issue texts. They are not the same!

User should be able to specify proxy url for api.github.com and raw.githubusercontent.com seperately.

Please let me know if I'm wrong. If I'm right, I can fix this with a PR.

GammaPi avatar Dec 31 '22 07:12 GammaPi

https://github.com/upptime/status-page/pull/444 Related

GammaPi avatar Dec 31 '22 07:12 GammaPi

In current definition, the user can replace apiBaseurl with a proxy like this:

location /XtTechGroup/Uptime/master {
    proxy_pass https://raw.githubusercontent.com;
    proxy_set_header Host raw.githubusercontent.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Protocol $scheme;
    proxy_set_header X-Forwarded-Host $http_host;
}

location /repos/XtTechGroup/Uptime/issues {
    proxy_pass https://api.github.com;
    proxy_set_header Host api.github.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Protocol $scheme;
    proxy_set_header X-Forwarded-Host $http_host;
}

Then what's the point of having an extra option to specify the proxy to raw.githubusercontent.com again?

GammaPi avatar Dec 31 '22 07:12 GammaPi

You're right, it makes sense to specify two URLs in the configuration, one for the GitHub API and one for the raw content URL. Happy to accept a PR!

AnandChowdhary avatar Dec 31 '22 22:12 AnandChowdhary

Good to hear. The github api interface is severely rate limited. It's better to split them into two urls so the developer can decide which to use.

GammaPi avatar Dec 31 '22 22:12 GammaPi

Thanks for the PR! Can you also please make a PR in upptime/upptime.js.org so we can add info about this new configuration property in the documentation?

AnandChowdhary avatar Jan 01 '23 11:01 AnandChowdhary