how to add entries for allowed hosts in the referrer filter node - aem

To prevent cross site request forgery, I want to try with referrer filter, and in the allowed hosts section, I want to add my trustable websites for instance site1.com, site2.com, site3.com etc.
My doubt is like do we need to specify https and all in the allowed host entry as below
https://site1.com or
specifying it as site1.com would do.
Thanks,
Balaji.

Simply the hostname is enough. site1.com will get you through. AEM will take care of both http and https with the hostname alone. By specifying the protocol explicitly , you can add restriction to allow requests from only, let's say, https referer.

Related

Override single API endpoint locally

Is it possible to override a single API end-point locally?
i.e:
https://jsonplaceholder.typicode.com/todos/1
To this one:
http://localhost:3000/todos/1
But without touching others end-point like:
https://jsonplaceholder.typicode.com/movie/1
I'm trying to find a tool to do this, I also tried to use the hosts file but it work only domain by domain, not for a single API endpoint.
You can use the Map Remote function in Charles. I believe similar feature exists in other HTTP proxy tool such as Fiddler too.
First, configure Map Remote and mapping https://jsonplaceholder.typicode.com to http://localhost:3000, limit the path to /todos/*, so that it won't impact /movie/1:
Then, as Charles is trying to intercept HTTPS site, you need to enable "SSL Proxying" and add jsonplaceholder.typicode.com (Otherwise, browser will ignore the interceptor or just throw a certificate warning):
It's done. In browser, access to https://jsonplaceholder.typicode.com/todos/1 or https://jsonplaceholder.typicode.com/todos/2 will be redirected to http://localhost:/todos/1 or http://localhost:3000/todos/2 internally, while access to https://jsonplaceholder.typicode.com/movie/1 is not touched.

Github pages and custom domain from 123Reg

I've got a custom domain from 123Reg - www.mydomainname.co.uk - which I want to use for my github page - mygithub.github.io
I've managed to set it up so that www.mydomainname.co.uk works, but it isn't using https and therefore shows as unsecure, how can I make it use https?
Also, is there a way of allowing mydomainname.co.uk to work as well?
First you should make sure HTTPS is working on https://www.mydomainname.co.uk (by default it should). You can Enforce HTTPS under your repository settings, so it would do the redirection from http to https.
To get your apex domain mydomainname.co.uk working, it's best if you do a redirection to www.mydomainname.co.uk from where you manage your DNS (some don't have the feature).

subdomain redirect to a specific port using SRV?

Lets say I have the following:
subdomain: xyz.mydomain.com
my server's public DNS: xyz.fastserver.com
when someone goes to xyz.mydomain.com I want them to be redirected to
xyz.mydomain.com:8080
I have full access to all the typical A(host), C(NAME) as well as SRV records etc, tried different configurations but cant get it to work.
Any ideas?
You did not explicitly specify it, but I assume you mean HTTP (i.e. web browsing) and not FTP, SIP, SMTP... and lots of the other protocols on the internet.
In this case what you are trying to do is not possible. DNS A/AAAA/CNAME records are only used to get an IP address, so you can not get a port with these settings. And SRV records are not used within HTTP, so you can not use it to specify the port too.
Link to previous post that goes over the difference between redirect, rewrite, and vhosts.
DNS, however, has no concept of "port" unless you make a special record (SRV) and then a special request to get that record. It is much more transparent to use one of the HTTP methods described above.

Redirect CNAME with path

I have old domain (bar.com), and new domain (foo.com). I want to redirect bar.com/path to foo.com/path by DNS only. Is it possible?
Other question:
Now I can make CNAME to redirect from *.bar.com to foo.com. But is possible if we can make redirect from *.bar.com/path to foo.com/path?
Thanks.
DNS is a complete different protocol to HTTP. It will not trigger any redirects nor does it know anything about URLs or paths.

exposing a sparql endPoint publicly?

I have a website power by a tomcat server. My application tap on a tripleStore that i would like to make public trough a sparql endpoint at www.mywebsiteaddress/sparql.
What configuration do i need on my webserver to do that ?
I use Jena Fuseki on the background which is running on the Port 3030 and my webserver is on the port 80.
My idea is that, when the webserver get a request on the port 80 about ..../sparql it redirect to fuseki sprql endPoint
This is more of a webservice / access control problem than anything SPARQL related. However, since SPARQL endpoints are supposed to be created as per the SPARQL spec, i think this a valid question, as I'm sure people will encounter it again in the future.
So, to answer your question, "public" usually means that certain headers are set in order to allow a request to hit the endpoint when it is not coming from the same domain. From there, you can specifically allow certain types of interactions with the endpoint. If you wanted to kinda just allow everything, you could set the following headers:
'Access-Control-Allow-Origin: *'
"Access-Control-Allow-Credentials: true"
'Access-Control-Allow-Headers: X-Requested-With'
'Access-Control-Allow-Headers: Content-Type'
'Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE //http://stackoverflow.com/a/7605119/578667
'Access-Control-Max-Age: 86400'
Depending on how you built the endpoint, it'll either have some settings somewhere where you can adjust the headers, or, you'll have find the headers settings for the application framework itself if you're using one. But, in general, the above headers would make it "public"