We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I site at https://myurl.com/select_block_id which gets redirected to by the nginx rule:
location /select_block_id/ { rewrite ^/select_block_id/(.*)$ /$1 break; proxy_pass http://localhost:42059; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
This directs to the page:
<!doctype html> <html> <head> <script src="https://unpkg.com/htmx.org@1.9.9"></script> </head> <body> <div hx-get="/form" hx-trigger="load">Click Me</div> <script> console.log('Root: ', window.location.href); async function thing() { const response = await fetch('/select_block_id'); const text = await response.text(); console.log('Response: ', text); } thing(); </script> </body> </html>
However on load I get a CORS error because my nginx redirects to an external url for root url (https://myurl.com/).
The Root console log returns https://myurl.com/select_block_id/ and the fetch request returns the correct html for the page.
https://myurl.com/select_block_id/
I believe that the issue is caused by htmx not correctly detecting the base url.
I can resolve this by this to the script tag:
document.body.addEventListener('htmx:configRequest', (event) => { event.detail.path = `/select_block_id${event.detail.path}` })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I site at https://myurl.com/select_block_id which gets redirected to by the nginx rule:
This directs to the page:
However on load I get a CORS error because my nginx redirects to an external url for root url (https://myurl.com/).
The Root console log returns
https://myurl.com/select_block_id/
and the fetch request returns the correct html for the page.I believe that the issue is caused by htmx not correctly detecting the base url.
I can resolve this by this to the script tag:
The text was updated successfully, but these errors were encountered: