Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
⁂ Kaleb
@kaleb@fedi.haugenh.us  ·  activity timestamp 4 days ago

Looking for some help with interaction issues between NGINX, HTMX, and GoToSocial.

The issue


My GET request from my website HaugenHus | Now Test

 hx-get="https://fedi.haugenh.us/@kaleb/feed.rss"
hx-headers='{"Accept": "application/feed+json"}'

…is returning two basic CORS errors:

  • [Error] Request header field HX-Request is not allowed by Access-Control-Allow-Headers.
  • [Error] XMLHttpRequest cannot load https://fedi.haugenh.us/@kaleb/feed.rss due to access control checks.

…that I can’t figure out how to resolve.

Things I’ve tried


I ’ve added

add_header 'Access-Control-Allow-Origin' 'https://fedi.haugenh.us';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, HX-Request';

to my nginx.conf (actually I’ve imported it from another .conf and verified that the config is being included with nginx -T), but it has no impact on the errors.

I have confirmed that the page loads successfully including the remote JSON when I set my browser to ignore CORS.

Additionally, I am able to successfully load the remote feed.rss when I use the hx-request='{"noHeaders": true}’, but doing so returns XML rather than the desired JSON due the JSON Feed implementation in GoToSocial RSS

#GTS #GoToSocial #nginx #CORS #JSONFeeds #HTMX

  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login