@kasir-barati actually shortly after posting this thread I had the same idea and already implemented the robots.txt through my reverse proxy
Good idea about replacing the favicon through the proxy as well! I'll do that too.
@kasir-barati actually shortly after posting this thread I had the same idea and already implemented the robots.txt through my reverse proxy
Good idea about replacing the favicon through the proxy as well! I'll do that too.
Hello,
Is it possible to include a robots.txt file with my FusionAuth self-hosted community instance?
My website which is live has a robots.txt file at the root domain (https://rootdomain.com/robots.txt), and FusionAuth is running at subdomain auth.rootdomain.com.
In Google Search Console, it is complaining that there is no robots.txt file for my auth subdomain at https://auth.rootdomain.com/robots.txt. It's my understanding that for Google search indexing, you need to have a separate robots.txt file for each subdomain.
As a result, Google is crawling and indexing the FusionAuth authorize and forgot pages with the various parameters in the url, which I want to block them from indexing.
How can I add a robots.txt file to the root of my auth subdomain?
@mark-robustelli Ignore my last post. I managed to do it. Full code incase someone else wants to use this:
#google-login-button{
background-color: white;
border: 1px solid #c5c8ca;
}
.login-button-container .login-button.google .text {
color: black;
}
@mark-robustelli That seems to do the trick. Since I want the background white, I need the text black but I can't seem to get it to work. I'm no expert with CSS but it seems setting the color property on the google-login-button style doesn't do it. Digging deeper into the browser html it looks like the class "text" on the div inside the button is controlling the color.
I've come across the same issue. FusionAuth and my webhook endpoint are both on the same network (docker compose). I've tried setting the webhook URL to the container name (invoicing.api) with the corresponding port, https://invoicing.api:5001. The call never reaches my api. Testing through Postman or Swagger which are running on the same machine but outside the docker network works fine using https://localhost:5001/fusionauthwebhook.
I came across a similar issue with FusionAuth and my web app authority URL not working when using the container name in the URL, but this was solved by using the local machine IP in it's place. That doesn't seem to work for webhooks. Using the local machine IP in the webhook URL, i.e. https://192.168.0.110:5001/fusionauthwebhook, didn't solve it.
Maybe I'm missing something obvious, but I can't seem to adjust any of the button properties for the Google login button.
Having followed the documentation to setup my Google client Id and secret, everything is working great, but in the Option section it gives you a link to Google's documentation where you can see the possible values to use for the Button properties.
By default, the Theme in FusionAuth is set to 'outline'. This can be seen on Identity Providers > Google > Options.
In the Google documentation the outline theme has a white background.
Yet my app is using the 'filled_blue' theme.
By the way, when trying to change any other setting in the Button properties, the button is unaffected. Not sure what is going on.
@mark-robustelli So I managed to solve it finally. I ended up setting a reverse proxy in Azure App service. This is my Nginx server config:
server {
listen 0.0.0.0:80;
# this is the proxy host
server_name auth.mydomain.com;
location / {
proxy_set_header Host $proxy_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;
proxy_set_header X-Forwarded-Port '443';
proxy_set_header X-Forwarded-Host auth.mydomain.com;
# this is the server FusionAuth is hosted on
proxy_pass https://mydomain.azurewebsites.net/;
}
}
So there's two points to keep in mind.
Azure App Service HTTPS requests don't enter the container. They are terminated at the front end. So we need to configure Nginx to listen on port 80 and not 443. Also seems like we don't need to setup any of our own certificates.
All the sample FusionAuth reverse proxy configurations posted on the FusionAuth github seem to be for reverse proxies hosted on the same server as the FusionAuth instance. In my case I am proxying to a different server so I needed to set a proxy header "Host $proxy_host;" instead of "Host $host;".
I hope this will be helpful for somebody else trying to set this up in Azure.
@mark-robustelli Just an FYI I opened a ticket with Azure support so I'll post back here when I have some updates.
@mark-robustelli After a bit more research, it looks like Fusionauth with HTTPS enabled won't be able to work in Azure:
I think I have no choice but to use a reverse proxy. I'll focus my attention on that now.
@mark-robustelli that thread is from 2020, and my understanding is that the new https properties were added in early 2023. So indeed using a proxy was the only way before but I don't see why using the new https properties shouldn't be a good route now.
In any case I also tried going the reverse proxy route by following some of the sample nginx configurations on the fusionauth github and I feel I was really close to getting it to work but not quite. I was getting some redirect errors. I may put more time into getting that to work instead of this route we've been trying.
I did not try kubernetes. I think it may be overkill. I may try using an apache server for the proxy and copying that code from your link. I struggled with nginx.
@robotdan does this mean a proxy is not required anymore? I've been trying to configure the new https properties without success.
@mark-robustelli Seems I didn't restart my container properly the first time. I did that again and I'm seeing some new errors in the docker logs regarding SSL.
So I think now the container is indeed listening on 443 since adding the new environmental variable WEBSITES_PORT, but something else is going wrong now. I need to look into what this error means:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
@mark-robustelli So you would need to either set the four environmental variables in Azure, or set the four properties in the .properties file. I chose the latter in the end.
@mark-robustelli Good catch, yes I see that too in my logs. I did a search and you can update the port that the container is listening on by adding an environmental variable WEBSITES_PORT.
After doing that and restarting the container, I can see in the log that port it is using 443 now.
But still I'm getting the same proxy warning in the dashboard But I think we're really close to figuring this out. It would be good to get the thoughts of Fusionauth engineer on this matter.
Btw I'm not sure if in your configuration you also setup the certificate environmental variables. I think in order to enable https, you need to set the port as well as the certificate files or the contents of the files.
@mark-robustelli Yeah seems like I'm getting closer but not sure what else to try regarding enabling HTTPS. Everything seems ok from my setup. I can't see any logs in Azure about incoming requests. I can only see startup logs.
So I made a bit more progress but it's disappointing news.
I managed to get the certificates to work correctly. I needed to convert the .pem private certificate to PKCS8. After doing that I don't get any error in the log when Fusionauth initializes, and I'm able to log into the dashboard unlike before, but disappointingly I'm still seeing the same Proxy Configuration Warning at the top of the page. I thought that using the inbuilt TLS listener would bypass the need for a proxy, or is that not correct? According to this request which has since been added, I'm given the impression that configuring HTTPS will bypass the need for a reverse proxy. Is there a way for me to confirm that the app is listening to https requests?
@mark-robustelli I came across a solution online. Changing the Authority in the webapp appsettings to the local machine IP address seemed to fix it.
"Authority": "http://10.1.20.69:9011",
I'm not sure I like this approach because my local IP probably isn't static. I would much rather localhost:9011 or fusionauth:9011 to work, but I don't understand networking enough to understand why they don't.
Anyway this issue will only be occurring in development so I can deal with it. In production each app will be hosted separately so using the public domain name as the authority should work.
@mark-robustelli @mark-robustelli It sounds like you were experimenting with Azure Container apps judging by the fact you mentioned ingress and container environments? I'm actually using Azure App Service, and I chose the container option for that. App Service and Container Apps are quite different in their settings.
I'll show you what I did in order to setup the TLS settings of Fusionauth, not the proxy approach I also tried. That one is a bit more involved.
I created a dockerfile and edited the fusionauth.properties. In my dockerfile I'm pulling the fusionauth image and copying into the container my SSL certificates generated using Let's Encrypt. Also you can see I'm copying in my updated fusionauth.properties file.
Here is my fusionauth.properties file:
I'm building the image and storing it on Azure to be accessible on Azure App Service. I'm not sure if I can export any settings from my Azure setup but I'll post screenshots.
Here are the deployment settings of my App service. You can see I'm pulling the fusionauth image I created.
These are the platform settings.
After doing all this, I am now getting an error related to the SSL certificates.
"Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid PEM format"
I think there might be an issue with the format I'm using (.pem), but this is the format Let's encrypt is outputting, unless something else is wrong. These are the files I'm getting from Lets encrypt.
@mark-robustelli I looked into Application Gateway but discovered its pricing would more than double my monthly cost for my app, so I discarded it.
Atm I'm experimenting with two different approaches:
setting up an Nginx proxy with SSL on Azure app service, so I can change the necessary headers. I've generated ssl certificates for my proxy through Lets encrypt, and reference them in my nginx config but I'm not doing something right because it just times out.
configuring the https settings in the fusionauth.properties file. By building my own docker image, I'm able to edit the configuration file and inject it into my image. From my understanding, we need to populate not only the setting to enable https, but also the port, and the paths to the ssl certificate files. I copied the Lets encrypt certificates into my image and set the paths in the config file but Fusionauth doesn't like something still. It might be the format of the certificate files. I'm still experimenting with this.
I hope you can make some headway with Azure.
@mark-robustelli yes it works just fine this way.