Skip to content

How to make cors work on Github Pages? #15523

Answered by chaejunlee
anburocky3 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, github pages don't give you a sever to work with. It only deploys static contents, such as HTML, CSS, JS.

I see that you are using proxy server which github pages don't provide. So, using proxy won't work if you are deploying your app on github pages.

try something like this:

fetch("https://ipv4.icanhazip.com/").then(v => v.text()).then(v => console.log(v))

Here is the working repro of what you are trying to do.

https://stackblitz.com/edit/github-zlyyvu?file=assets/js/main.js,vite.config.js

If it helped, please mark me as an answer. Thank you.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chaejunlee
Comment options

@chaejunlee
Comment options

@anburocky3
Comment options

Answer selected by anburocky3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants