XY: I’m running Laravel application, it’s used to be integrated into external webpages as a widget through using HTML tag. This requires replacing X-Frame-Options header’s value from SAMEORIGIN to allow-from https://my-domain.com. Also, I’m using Cloudflare as my DNS manager, but it looks like headers are still received from Fly.io, as via headers value equals 1.1 fly.io.
Question: I tried to replace X-Frame-Options value through providing next lines in my projects fly.toml file:
Is there any idea how I could overcome this issue and set own X-Frame-Options value?
EDIT: I’ve also tried to change X-Frame-Options via Transform Rules for Cloudflare, but doesn’t seem that it can override Fly.io settings here. Proxy status for all DNS records set to “DNS only” according to this docs.
Overall I think the most important thing to find here is that allow-from isn’t going to work in modern browsers. You should check out CSP headers, or try to get Fly to remove the x-frame-options header.
@fideloper-fly thanks for answering my questions! Unfortunately, your solution haven’t succeeded for me. Here’s some background of what I’ve done:
I switched from Cloudflare so my DNS are now directly pointed to Fly.io from my domain provider’s settings. All header settings should now be delivered directly from Fly.io.
I have multiple .toml files as I use same application for 3 different Fly.io instances (actually 3 domain for 3 countries and requires different set of capabilities). All other settings were working well before, but might this be a problem this time?
Tried to add X-Frame-Options with frame-ancestors included – didn’t worked, tried to disable X-Frame-Options through removing header using this line: http_options = { response = { headers = { via = false } } } – didn’t worked too.
… anything else that might be missing here? [services.ports.http_options.response.headers] position in my .toml is right after [[services.ports]]. Here I share whole .toml file:
Not sure what’s up there. If you have 3 apps, are you definitely deploying to the one you expect? Does fly status (pointing to the correct app) show you what you expect?
The other thing is to check your whitespace and maybe move those options to last.
I don’t really think this should matter, but maybe lets be sure! Here’s what works for me:
If you can’t get that working, try creating a new app to see if the same settings Just Work on that new application (you can destroy that new application later if you want). If the new application Just Works™, we can see if some issue is specific to that one app that’s not picking up those issues.
You were right, I needed to mention the config file as a parameter during the deployment. For others who would be looking for this information:
flyctl deploy --remote-only --config fly.[YOUR-APPLICATION-NAME].toml -a [YOUR-APPLICATION-NAME]
Actually, disabling X-Frame-Options helped me, now I will adjust Content-Security-Policy to make it work. Huge thanks to @fideloper-fly for helping to find the solution! Great job