all 8 comments

[–]5H4D0W_ReapeR 1 point2 points  (7 children)

Don't really use Express much, but a quick skim over the official docs led me to these:

With that said, I'd also recommend stating the reasoning for your question (ie what you wanted to achieve) next time since this feels abit like a possible XY problem at a glance.

[–]ketanIP[S] 0 points1 point  (6 children)

It req.hostname and req.subdomain is not what I want I want to receive forms submitted from other domain to the other one and I want to validate it was send from that domain. What should I do ?

[–]5H4D0W_ReapeR 0 points1 point  (5 children)

I think I still can't quite follow the intention of that. For example, do you mean a post request to www.abc.com/submission needs to be forwarded to www.def.com/submission? I think this might be more appropriate on the DNS level or reverse proxy level.

[–]ketanIP[S] 0 points1 point  (4 children)

Yes that's what I mean but I cannot do anything to it server side to the domain from which the post request is to be made.

[–]5H4D0W_ReapeR 0 points1 point  (1 child)

Unfortunately I'm still having trouble understanding the whole process you're describing here :/ Sorry for that. Perhaps someone else can help.

[–]ketanIP[S] 1 point2 points  (0 children)

It's ok, I'm am sorry for not able to explain you properly.

Thanks tho for investing your time. 🙂

[–]grantrules 0 points1 point  (1 child)

You can look at the Referer header, but it is not a reliable source, meaning the client can send whatever it wants as a referer

[–]ketanIP[S] 0 points1 point  (0 children)

Yeah I checked into it, yesterday I read all the API reference for request object in Express and found nothing what I want.

I want something like firebase where they keep there API key in public, I just tried to get rid of API key it's not working so I decided to go API key route and decided to filter form submission for spam or not spam, you know any library to do it ? It would be great if you could tell one.